Hi All,
I am running a COBOL program which reads an input file and creates two reports as output. But just after reading the input file, I have put some display like -
Code:
READ INPUT-FILE INTO LBC005-SUB-BILL-IO-AREA
AT END
GO TO 700-CONTROL-RPT.
GO TO 650-SUMMARY-RPT.
ADD 1 TO WS-INPUT-READ.
DISPLAY 'INPUT-REC=' LBC005-SUB-BILL-IO-AREA
The display is giving some absurd values at some particular position and at a specific record. I have checked the input file but that record is not having any issue at all. It is coming fine when I open it using its copybook. But while reading then why it is coming with some junk values? The file is also not in pack on status-it is in "PACK OFF" profile. Ohh! I am using the following JCL to run my program -
I thought it is some problem with memory and tried in program step to use a buffer card (which in reality does not help in any way!). And then I tried to use some extra space in my program step (by SYSOUT**-does not help again!). Guys any idea why I am getting this kind of problem? Pls help me guys!
Joined: 31 Oct 2006 Posts: 1042 Location: Richmond, Virginia
You seem to have a period (.) after your first GOTO in the AT END, which makes sense, as you cannot have two GOTO's in a row, or the compiler would have flagged that as either an error or dead code.
Therefore, your 2nd GOTO is not part of the condition AT END, and is therefore being taken after your first READ.
Nop man! The problem was something else! I defined the copybook LBC005 in working storage obviously but if I declare it in the FILE SECTION after FD, it is working fine. Still don;t know the reason? Any further input pls!
You seem to have a period (.) after your first GOTO in the AT END, which makes sense, as you cannot have two GOTO's in a row, or the compiler would have flagged that as either an error or dead code.
Therefore, your 2nd GOTO is not part of the condition AT END, and is therefore being taken after your first READ.
I think, After the first read it is executing second GO TO and not coming back. Please give some DISPLAY statements in 700-CONTROL-RPT and verify whether your code is executing till End Of File.