I have one more requirement here to repeat the header whenever there is a key change.
Input file -
Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7
Date of process :09/16/11 DATA11 123456798
Data11
Data12
Data13
Data21
Data21
Data23
Data31
Data32
Data33
Output file -
Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7
Date of process :09/16/11 DATA11 123456798
Data11
Data12
Data13
Date of process :09/16/11 DATA21 123456798
Data21
Data21
Data23
Date of process :09/16/11 DATA31 123456798
Data31
Data32
Data33
Both the input and output files are LRECL/RECFM - VB/334.
Thank you for the quick response. Actually the solution did work for writing a new header, but mine is to repeat the existing header with few modifications.
Please let me know if you come across any such scenario.
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
Quote:
repeat the header whenever there is a key change
Sorry, I took this too literally I suppose, didn't check against the data provided and notice the one character in the middle of the data that is different :-)
I thought you might get to a different problem, being how to get the basic header information, rather than the "break" key, which should be fine with this.
Can you post what you got as your solution for the first part?
This file is getting received from other application and they are populating values after the 100th byte which wont be constant in the header record. So building as mentioned wont work. I should have mentioned it before . One more information missed is there can be only three type of records that can be present in the dataset (DATA1, DATA2, DATA3).
I tried using the below code to repeat the header records...But the issue here is the dataset does not always contain all the datatype records.
Was able to achieve the output using symnames by splitting the header record as shown
Code:
SORT FIELDS=COPY
INCLUDE COND=(5,4,CH,EQ,C'DATE')
OUTFIL BUILD=(C'HEAD1,''',5,49,C'''',80:X,/,
C'HEAD2,''',60,70,C'''',80:X,/,
C'HEAD3,''',130,70,C'''',80:X,/,
C'HEAD4,''',200,70,C'''',80:X,/,
C'HEAD5,''',270,64,C'''',80:X),VTOF
If you take a look at the code HEAD2/3/4/5 are just the breakup of the record becoz of the limitation of SYMNAMES record length. Is there any way we can assign only one symbol for the record starting from position 60 - 334 by providing any conituation character ?
Here the header record is rebuilt whenever the data type varies.