Joined: 10 Jun 2021 Posts: 1 Topics: 1 Location: USA
Posted: Mon Jun 14, 2021 7:01 pm Post subject: How to save and/or compare information from previous record
I've looked high and low for this example. There are many almost like it, but none that I see hit the mark. I need to process a given record, based on the previous record. I'd like to use DFSORT/ICETOOL for a solution.
I've done quite a lot with DFSORT, but have limited experience with ICETOOL syntax.
I have a file that looks as follows, and for the sake of discussion it's FB, LRECL=80. It is sorted by key and line.
I'd like the output to be 2 files that look as follows:
Header file:
Code:
KEY1 DATA1
KEY1 DATA2
KEY3 DATA7
Detail file:
Code:
KEY2LINE2 DATA6
KEY3LINE2 DATA9
KEY4LINE1 DATAB
The rules are, that if the first record of a group (KEY) has a value 'COM' in column 10, then treat the data as 'header' data. All contiguous 'COM' records will also be treated as 'header' data, as shown with the KEY1 value.
If a record is not a COM record, then it may be the start of string of 'line' data, as shown by KEY2-LINE2.
Said another way, all COM records need to be reference the previous non COM record of the same KEY, or be treated as a header record.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum