Consultor Eletrônico



Kbase P157771: 4GL/ABL: Error (557) using the SET and the INPUT FROM statement to read data into an EDITOR widget.
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   23/12/2009
Status: Unverified

SYMPTOM(s):

4GL/ABL: Error (557) using the SET and the INPUT FROM statement to read data into an EDITOR widget.

** File input too long: <string>. (557)

Using the following code to read more than 640 characters from a file into an EDITOR widget:

DEFINE VARIABLE cVariable AS CHARACTER VIEW-AS EDITOR INNER-LINES 20 INNER-CHARS 50 BUFFER-LINES 20 BUFFER-CHARS 50 MAX-CHARS 1000 .
INPUT FROM Flat.txt.
SET cVariable.
INPUT CLOSE.

The file was created by the following code contains more than 640 contiguous characters:

DEFINE VARIABLE cVariable AS CHARACTER NO-UNDO.
ASSIGN
cVariable = FILL("A", 641).
OUTPUT TO Flat.txt.
PUT UNFORMATTED cVariable.
OUTPUT CLOSE.

FACT(s) (Environment):

All Supported Operating Systems
Progress 9.x
OpenEdge 10.x

CAUSE:


There is a hard limit of 640 characters per token (a token is a string of characters terminated by white space) when reading from a file using INPUT FROM.

FIX:

Use the READ-FILE() method of the EDITOR widget to pump the data from a file into the editor widget. For example:
DEFINE VARIABLE cVariable AS CHARACTER VIEW-AS EDITOR INNER-LINES 20 INNER-CHARS 50 BUFFER-LINES 20 BUFFER-CHARS 50 MAX-CHARS 1000 .
DEFINE FRAME EditorFrame
cVariable NO-LABEL .
cVariable:READ-FILE("Flat.txt").
MESSAGE cVariable:SCREEN-VALUE
VIEW-AS ALERT-BOX INFO BUTTONS OK.