Reading a text file in opencobolile

158 Views Asked by At

(Windows 11) I am creating a text file of currently running tasks and I am having difficulty reading it into my OPENCOBOLILE program. The open is fine, but on the first read I receive an error code 1000 (file size error). In looking at the file it seems to be a variable length file with crlf. I am an as/400 Cobol programmer, getting back into Cobol after quite a few years and I've never done any COBOL coding on Windows. Can anyone offer any advice on how to set up my file select or environment variables to read this file? Thank you!


Environment division.
       input-output section.
       file-control.
           select webinput assign to KEYBOARD
                file status is ws-in-status.
           
           select tasklist ASSIGN TO 'g:\temp\tasklist.txt'
                file status is ws-if-status.

       data division.
       file section.
       fd  webinput.
           01 chunk-of-post        pic x(1024).
               
       fd  tasklist.
           01 Ws-Input-Data.
               05  filler          pic x.
               05  ws-id-name      pic x(12).
               05  filler          pic x(1011).

PROCEDURE DIVISION.
           OPEN InPUT tasklist.
               display ws-if-status.
               PERFORM UNTIL WS-EOF='Y'
                   READ tasklist at end
                       display ws-if-status
                       MOVE 'Y' TO WS-EOF
                       NOT AT END DISPLAY ws-value-string
                   END-READ
                END-PERFORM.
           CLOSE tasklist.
           STOP RUN.

enter image description here

0

There are 0 best solutions below