It's easy to do with a COBOL program but It would be much better (faster) in a DFSORT step... if it's possible (after searching in DFSORT application programming, I don't think so) !
record length = 133
If the field (1:8) is not blank (<> spaces) the whole record is written in the output
Else
the field (1:8) takes the value of the previous record whose same field (1:8) wasn't blank
NB : the field (1:8) of the first record is always filled.
(in fact is to transform a report file in a flat file)
Ex :
Input
FIRSTREC REST OF THE RECORD 1 --------------------------
SECNDREC REST OF THE RECORD 2 --------------------------
spaces... REST OF THE RECORD 3 --------------------------
spaces... REST OF THE RECORD 4 --------------------------
Output
FIRSTREC REST OF THE RECORD 1 --------------------------
SECNDREC REST OF THE RECORD 2 --------------------------
SECNDREC REST OF THE RECORD 3 --------------------------
SECNDREC REST OF THE RECORD 4 --------------------------
Overlay of the filed 1:8 in 3rd and 4Th records from 2ND record.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Yes, you can do this with the DFSORT/ICETOOL job shown below. You'll need z/OS DFSORT V1R5 PTF UK90007 or DFSORT R14 PTF UK90006 (April, 2006) in order to use INREC with SPLICE. If you don't have the April, 2006 PTF, ask your System Programmer to install it (it's free). (Or alternatively, you can do it in two passes with a COPY operator followed by a SPLICE operator using a temporary data set.) For complete details on all of the new DFSORT and ICETOOL functions available with the April, 2006 PTF, see:
Your solution is very interesting, thank you, it shows the powerful of ICETOOL.
But it wasn't exactly what I expected because in my example I took firstrec and secndrec like alphanumeric values (characters) and not for numeric value (seqnum of the record). So I see in your solution (if I didn't understand, tell me) that you find out the result by subtracting seqnum of the record = space into the seqnum of record (any), and I must recognize it's very elegant.
So you don't have to know the value of the field 1:8.
But if I have to take this value to fill in the blank (1:8) record which succeed (my problem), what is you proposal ?
Thank you again for your quick and detailed reply.
PS : I didn't find the parameter "sub" in "USE Guide for DFSORTPTFs UQ95214 and UQ95213"
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
The use of the seqnum (sequence number) has nothing to do with the value in positions 1-8. The value in positions 1-8 can be anything you like. In fact, I used your character values and got the output records you asked for.
The seqnum is used to create group numbers that allow us to propagate the value from the first record of the group (non-blank in positions 1-8) to the other records of the group (blank in positions 1-8). For more details on this "group" technique, see the "Include or omit groups of records" and "Sort groups of records" Smart DFSORT Tricks at:
I always test any solutions I provide to ensure they give the requested output. The DFSORT/ICETOOL job I provided gives the output you requested based on the input you showed. In the future, please try my solutions rather than assuming they don't do what you ask for. If you did test it and didn't get the correct results, then that's because you don't have the April, 2006 PTF which I warned you about.
SUB is for subtraction. You didn't find it in the description for the Dec, 2004 PTF because it was available before that.
Thank you again.
Sorry, I was wrong in my conclusion : the "move" was done by the splice of course (1:8 out of the with clause). Be sure I have no doubts about your professionalism.
I couldn't test the script because I'm on hollydays this week.