I have the following input file layout :
Record format . . . : VB
Record length . . . : 79
VAR1 PIC X(20)
VAR2 PIC 9(04) BINARY. (This indicated the VAR3 field length)
VAR3 PIC X(**).
VAR4 PIC 9(08) BINARY.
I want to reformat as:
VAR1 PIC X(20)
VAR3 PIC X(33). (33 is the max length I expect the VAR3 to be)
VAR4 PIC 9(08) BINARY.
I searched over the forums and already went through the IBM DFSORT manuals but haven't found any example like this.
I have both Z/OS DFSORT V1R5 and SYNCSORT FOR Z/OS 1.2.3.1R installed
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
Francisco javier Niño,
Input field lengths sum up to only 59 though the LRECL is 79. Do you have any other fields in your input file? Also is your output file of FB/LRECL=57 ?
Sorry Arcvns, You're right the correct RECL is 59 (20+2+33+4).
And Yes VAR4 position changes depending on the length of VAR3.
Thanks for your quick response.
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
Francisco javier Niño,
I should have asked this in the previous post. Your input file should have a 4 byte RDW in addition to the fields you mentioned, since it's a VB file. Wont that make the LRECL=63
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
arcvns,
I am not sure if OP wanted a FB file. I just provided a sample for creating the fixed portion of var3 (33 bytes) keeping the input dataset attributes the same.
Thanks arcvns, very bright solution, Just tested it and it worked fine.
On the other hand, this was the simplest of all my cases, I was expecting to extent this solution to my other cases. This solution is very case specific, I was thinking there maybe somehow to use the size field as parameter for the next field formatting.
I have another case where I have not one but two variable size fields, in that case I'll have to create the combination of all possible two fields size to obtain the same result.
E.G.
VAR1 PIC X(20)
VAR2 PIC 9(04) BINARY. (This indicated the VAR3 field length)
VAR3 PIC X(**).
VAR4 PIC 9(04) BINARY. (This indicated the VAR5 field length)
VAR5 PIC X(**).
VAR6 PIC 9(08) BINARY.
I want to reformat as:
VAR1 PIC X(20)
VAR3 PIC X(33). (33 is the max length I expect the VAR3 to be)
VAR5 PIC X(17). (17 is the max length I expect the VAR5 to be)
VAR6 PIC 9(08) BINARY.
I can have as much as 7 variable fields in a single record. Then this solution will be no longer easily extensible. Is there other general approach I could use? Or in this case it will be better just to write a program?