The goal of this exercise is to read and store an input file into a table then validate certain fields within the input and output any error records. The input file that needs to be stored is 285 records. The problem is that each record is different, with it's own copybook, so I don't know how to load it to a table to where I could search each 10, 20, or 32 record for a certain field. Here's a sample of the input file FYI... Not sure if my current code would be needed at this point as there's not much in it except for a READ statement.
10A 018517 2005062520060625
20A 018517000861038
32A 018517 79372
60A 0185172020 6 4
94A 018517 080 1
10A 027721 2005082520060825
20A 027721000187062
32A 027721 05038
60A 0277212003 6 4
94A 027721 090 1
....
I was able to load the file into the table, but now my dilemma is how to search each different record field in the table to validate? i.e. how can I validate that the zip code in record 32 is numeric?
I know I could read into the copybook, but I don't how, or if its even possible, to read a file into multiple copybooks and then store it all in a table.. if that makes sense.
Any advice on where to go from here would be greatly appreciated!
A couple of question
If you need to store the whole file in a table, Basically you could
When you want to Test a Table-Entry check the record-type and move the table entry to the appropriate copybook.
01 File-Records.
03 filler occurs 285.
05 Table-Entry Pic X(80).
05 Filler redefines Table-Entry Pic XX.
88 Record-Type-10 value "10".
....
88 Record-Type-94 value "94".
Evaluate true
when Record-Type-10(table-index)
Move Table-Entry(table-index) to Copybook-10
...Whatever processing is needed...
...
when Record-Type-94(table-index)
Move Table-Entry(table-index) to Copybook-94
....
end-evaluate
I would prefer to
in which case logic like the following could be used
Evaluate true
when Record-Type-10
if group-in-error
...write all the table-entries to the Error-File...
end-if
set group-in-error-off to true
move 1 to table-index
... Record-Type-10 tests ...
when group-in-error
continue
when Record-Type-20
... Record-Type-20 tests ...
end-Evaluate
move Intput-record to Table-entry(table-index)
Add 1 to table-index