Kbase P148803: 4GL/ABL: Session hangs executing SEEK function
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  30/06/2009 |
|
Status: Unverified
SYMPTOM(s):
4GL/ABL: Session hangs executing SEEK function
SEEK function crashes / hangs the session.
Executing the following code:
DEFINE VARIABLE cSourceFile AS CHARACTER NO-UNDO.
DEFINE VARIABLE cLineOfText AS CHARACTER NO-UNDO.
DEFINE VARIABLE iBytesRead AS INT64 NO-UNDO.
DEFINE VARIABLE iBytesWritten AS INT64 NO-UNDO.
DEFINE STREAM stream-in.
DEFINE STREAM stream-out.
ASSIGN
cSourceFile = "protermcaps.txt".
INPUT STREAM stream-in FROM VALUE(cSourceFile) NO-ECHO NO-MAP.
OUTPUT STREAM stream-out TO PRINTER PAGE-SIZE 66.
REPEAT ON STOP UNDO, LEAVE WITH FRAME f_Print:
IMPORT STREAM stream-in UNFORMATTED cLineOfText.
DISPLAY STREAM stream-out cLineOfText WITH FRAME f_Print NO-LABELS STREAM-IO NO-BOX USE-TEXT WIDTH 255.
END.
ASSIGN
iBytesRead = SEEK(stream-in)
iBytesWritten = SEEK(stream-out) NO-ERROR.
INPUT STREAM stream-in CLOSE.
OUTPUT STREAM stream-out CLOSE.
FACT(s) (Environment):
All Supported Operating Systems
Progress 9.x
OpenEdge 10.x
OpenEdge Category: Language (4GL/ABL)
CAUSE:
The SEEK function returns the offset of the FILE pointer in a text file as an INT64 value and can not be used with a PRINTER stream.
FIX:
Do not invoke the SEEK function against a PRINTER stream and call the LINE-COUNTER function to return the current line number of the PAGED PRINTER output stream instead. For example:
ASSIGN
iLinesWritten = LINE-COUNTER(stream-out).