I have to use this control card in many steps, only difference is the Length (that I am trying to use as a constant here) varies. In order to avoid coding mutiple cards, I thought of having one common and using SYMBOLS.
The Input File 1 lvaries everytime and it length varies. The output file length should match with that of input file 1. In this particular case, the input file length is 10562. So I want to pass this 10562 in the SORT CARD as a constant.
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
You are still not Code'ing your posts. It makes it easier for people to help you if they can see everything lined-up correctly. If you continue to ignore this, you'll probably get less help.
The record-length in Sort doesn't work in the way you think it does.
What you do is place the RDW from your variable input file into position 1 in the output file(s).
Code:
BUILD=(1,4,C'XXXXX',5)
This will copy the RDW, put five Xs in data-positions 1-5, and follow that with the variable-length intput record (from position 5, in this case, to the end of the current record). Sort will take care of the output record-length from the data that you provide, or the presence of IFOUTLEN.
If you leave the DCB information off the output files, Sort will supply it automatically.
If you input records are 10562, then the above should do you. For the "header" you are creating, just OVERLAY what you want, unless you have a need to blank the rest of record, in which case
For the non 000 records, you have the entire record already sitting there, so no need to BUILD anything (as you're not changing anything).
You are putting a TRAILER1 trailer on, but leaving the 999 record, I assume that is what you want.
It doesn't matter where you physically put the SORT and SUM, they will operate after the JOINKEYS has run. Since your file is then in key order, no need to sort it again.