IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

VB file copy COBOL program gives error message sometimes


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
anonguy456

New User


Joined: 29 Jun 2021
Posts: 16
Location: India

PostPosted: Thu Sep 09, 2021 4:15 pm
Reply with quote

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
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Thu Sep 09, 2021 8:33 pm
Reply with quote

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
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3048
Location: NYC,USA

PostPosted: Fri Sep 10, 2021 7:13 pm
Reply with quote

Duplicate locked- ibmmainframes.com/viewtopic.php?p=353023#353023
Back to top
View user's profile Send private message
anonguy456

New User


Joined: 29 Jun 2021
Posts: 16
Location: India

PostPosted: Wed Sep 15, 2021 5:52 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Using API Gateway from CICS program CICS 0
No new posts Error to read log with rexx CLIST & REXX 11
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts Error when install DB2 DB2 2
Search our Forums:

Back to Top