Joined: 20 Feb 2008 Posts: 5 Location: Melbourne, VIC
Is it possible to overlay the contents of a field for one record with the value of a previous record using ICETOOL/DFSORT ?
My specific example is that if the current record = ‘0410’ in pos 7 for 4 characters and the previous record = ‘0210’ in pos 7 for 4 characters and the date field (pos 127 for 6 characters) in the current record does not equal that of the previous record then I wish to overlay the date field in my current record with the date of the previous record.
This is my sort JCL but it doesn’t overlay any values
Yes. You use IFTHEN=(WHEN=GROUP with BEGIN= to define a group, and PUSH the data from that record to an extension on each record in the group. Since at most you want two records in the group, you code RECORDS=2.
The, on identifying the second record-type, you test the extended fields as needed and OVERLAY the required data if the tests indicate.
(you can these days code the individual elements of the DCB rather than the DCB itself) you will be able to extend a record beyond 4100 (which is four bytes of RDW and 4096 bytes of data, I'm always initially suspicious when a VB LRECL is a round number..) with no problem.
DFSORT will supply the LRECL.
However, I'm not sure you are achieving what you want. The VB records you are changing will retain the extension you have given. When temporarily extending a V record, it is conventional (as it uses fewer resources) to extend the record at the beginning and then to drop the extension once it is finished with.
Use IFTHEN=(WHEN=INIT with BUILD something like this (1,4,nnX,5).
Replace nn by the number of bytes you need to extend by.
That will copy the RDW (necessary) leave a bunch of blanks, then copy the first position of the data (5) to the end of the variable-length record (because there is no "length" specified).
Then, when you have finished with the extension, BUILD=(1,4,<5+nn>).
When extending, only do so by the data you actually use. There is no point in extending by 380 bytes if you only use 12 of them. Extend by 12.