View previous topic :: View next topic
|
Author |
Message |
anonguy456
New User
Joined: 29 Jun 2021 Posts: 16 Location: India
|
|
|
|
The code below works most of the times, but in some instances it does not copy all records i.e., if there are 1000 records it will copy 996 records and then at 997th row displays error message " * I/O error detected, I/O terminated * ". I need help in fixing this.
NOTE: Its not an issue related with space since at times it is able to copy files bigger than this which has got more records.
Code: |
IDENTIFICATION DIVISION.
PROGRAM-ID.
TST01.
*PROGRAM THAT WILL COPY NORMAL PROD VB FILE
*
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT INPUT01 ASSIGN TO CHK01.
SELECT OUTPUT01 ASSIGN TO CHK02.
*
DATA DIVISION.
FILE SECTION.
FD INPUT01
BLOCK CONTAINS 0 RECORDS
RECORD IS VARYING IN SIZE FROM 4 TO 24810
DEPENDING ON REC-LEN.
01 INPUTFILE01 PIC X(24810).
88 ENDOFINPUTFILE01 VALUE HIGH-VALUES.
FD OUTPUT01
BLOCK CONTAINS 0 RECORDS
RECORD IS VARYING IN SIZE FROM 4 TO 24810
DEPENDING ON REC-LEN2.
01 OUTPUTFILE01 PIC X(24810).
WORKING-STORAGE SECTION.
01 REC-LEN PIC 9(5) COMP.
01 REC-LEN2 PIC 9(5) COMP.
*
PROCEDURE DIVISION.
MAINPROCEDURE.
OPEN INPUT INPUT01
OPEN OUTPUT OUTPUT01
READ INPUT01
AT END SET ENDOFINPUTFILE01 TO TRUE
END-READ
PERFORM WRITEFILE UNTIL ENDOFINPUTFILE01
CLOSE INPUT01
CLOSE OUTPUT01
STOP RUN.
WRITEFILE.
MOVE REC-LEN TO REC-LEN2
MOVE INPUTFILE01(1:REC-LEN) TO OUTPUTFILE01
WRITE OUTPUTFILE01
READ INPUT01
AT END SET ENDOFINPUTFILE01 TO TRUE
END-READ.
|
|
|
Back to top |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
Did you look in the JESMSGLG?
There should be System messages which provide more information.
One or more of them could be used to help you resolve your issue. |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3048 Location: NYC,USA
|
|
Back to top |
|
|
anonguy456
New User
Joined: 29 Jun 2021 Posts: 16 Location: India
|
|
|
|
Yes Dave, I checked JESMSGLG and there was nothing.
NOTE: While running the job gives return code 0 even though in output we are getting error message " * I/O error detected, I/O terminated * ". |
|
Back to top |
|
|
|