I am looking for some help with a COBOL problem:
the problem is basically verifying an variable length input file is a valid record and if not change the input file definition to correct for this.
The code as is stands is:
03 FILE1-RECORD.
04 FILE1-INFO1 PIC X(90).
04 FILE1-NUMBER1 PIC 9(8).
04 FILE1-INFO2 PIC X(248).
04 FILE1-NUMBER2 PIC 9(8).
04 FILE1-TABLE-INFO1 OCCURS 1 TO 100
DEPENDING ON FILE1-NUMBER1.
05 FILE1-INFO3 PIC X(267).
04 FILE1-TABLE-INFO2 OCCURS 1 TO 100
DEPENDING ON FILE1-NUMBER2.
05 FILE1-INFO4 PIC 9(2).
03 WS-NUMBER1 PIC 9(8) VALUE 100.
03 WS-NUMBER2 PIC 9(8) VALUE 100.
03 WS-RECORD.
04 WS-INFO1 PIC X(90).
04 WS-N1 PIC 9(8).
04 WS-INFO2 PIC X(248).
04 WS-N2 PIC 9(8).
04 WS-CARDHOLDERS-INFO OCCURS 1 TO 100
DEPENDING ON WS-NUMBER1.
05 WS-INFO3 PIC X(267).
04 WS-TRANSACTION-INFO OCCURS 1 TO 100
DEPENDING ON WS-NUMBER2.
05 WS-INFO4 PIC 9(2).
The data is first moved from the file1 record structure to the working storage.
I want to verify that FILE1-NUMBER1 is correct (I can do this as if it reads past the end of this table it will hit numeric data rather than alpha-numeric data) and thus be able to read the second array correctly.
The main problem is referencing the second array if the first arrays ODO variable is incorrect, even though I have found a way to find the correct value in the program I cannot seem to make the input structure dynamic enough to update the input file structure so that for example say if originally file1-number1 is 4 and after checking this I find it to be 3, the program does not seem able to change where it is looking for the second array. The maximum size of the array is 100 for both arrays. I set the initial values of WS-NUMBER1 to 100 so to take the whole record if either FILE1-NUMBER1 or FILE1-NUMBER2 are less than the extents of the tables they are meant to refer to.
When I run my code perfroming functions on the second array it abends due to it not reading from the correct place.
If anyone has any advice or code it would help greatly.
Matt
p.s. I am using COBOL 2 on an MVS mainframe.
the problem is basically verifying an variable length input file is a valid record and if not change the input file definition to correct for this.
The code as is stands is:
03 FILE1-RECORD.
04 FILE1-INFO1 PIC X(90).
04 FILE1-NUMBER1 PIC 9(8).
04 FILE1-INFO2 PIC X(248).
04 FILE1-NUMBER2 PIC 9(8).
04 FILE1-TABLE-INFO1 OCCURS 1 TO 100
DEPENDING ON FILE1-NUMBER1.
05 FILE1-INFO3 PIC X(267).
04 FILE1-TABLE-INFO2 OCCURS 1 TO 100
DEPENDING ON FILE1-NUMBER2.
05 FILE1-INFO4 PIC 9(2).
03 WS-NUMBER1 PIC 9(8) VALUE 100.
03 WS-NUMBER2 PIC 9(8) VALUE 100.
03 WS-RECORD.
04 WS-INFO1 PIC X(90).
04 WS-N1 PIC 9(8).
04 WS-INFO2 PIC X(248).
04 WS-N2 PIC 9(8).
04 WS-CARDHOLDERS-INFO OCCURS 1 TO 100
DEPENDING ON WS-NUMBER1.
05 WS-INFO3 PIC X(267).
04 WS-TRANSACTION-INFO OCCURS 1 TO 100
DEPENDING ON WS-NUMBER2.
05 WS-INFO4 PIC 9(2).
The data is first moved from the file1 record structure to the working storage.
I want to verify that FILE1-NUMBER1 is correct (I can do this as if it reads past the end of this table it will hit numeric data rather than alpha-numeric data) and thus be able to read the second array correctly.
The main problem is referencing the second array if the first arrays ODO variable is incorrect, even though I have found a way to find the correct value in the program I cannot seem to make the input structure dynamic enough to update the input file structure so that for example say if originally file1-number1 is 4 and after checking this I find it to be 3, the program does not seem able to change where it is looking for the second array. The maximum size of the array is 100 for both arrays. I set the initial values of WS-NUMBER1 to 100 so to take the whole record if either FILE1-NUMBER1 or FILE1-NUMBER2 are less than the extents of the tables they are meant to refer to.
When I run my code perfroming functions on the second array it abends due to it not reading from the correct place.
If anyone has any advice or code it would help greatly.
Matt
p.s. I am using COBOL 2 on an MVS mainframe.