The requirement is:
1. Left Justify the first 15 bytes
2. If the first 15 bytes(excluding leading spaces) is Numeric, remove off the leading zeroes
3. If the first 15 bytes(excluding leading spaces) is NOT Numeric, DON'T remove off the leading zeroes
The I/P file is FB file of 80 bytes & O/P is required with similar specifications.
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
Hey Rahul,
You might want to modify this slightly as the OP's first input field has leading spaces and is of length=15, and the 'overlay' still retains the original input data.
Learncoholic,
The number of leading blanks, will that remain the same or it can vary too?
Then, it is not terribly difficult to change the above mentioned sort card.
You need to replace the leading spaces with zeroes to check if numeric and keep a copy of the original data (do this in Inrec) and use it for overlay edit and sqz.
But, as you have shown no signs of any kind of attempt/effort to achieve what you want, it would Not be worth to give you the code.
The Non Numeric fields are appended with zeroes.
I tried with storing of original data from 100th Bytes in INREC.
However, I guess that OVERLAY/FINDREP/BUILD cannot go togehter with INREC.
I used 2 SORT card to achieve it. It is possible in one?
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
Glad you were able to work it out, based on what Rahul suggested above.
You can combine all the IFTHENs into your INREC OR OUTREC. You don't need both. Use INREC/OUTREC IFOUTLEN=n to get rid of the padded bytes and restrict the record length to 'n' bytes.
Also you don't need the '16:16,64' in your OVERLAYs - OVERLAY retains the value of data positions which are not modified by it.
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
Cool. Like mentioned earlier, you could remove the data positions you don't intend to modify, from your OVERLAYs. No big deal here, but a thing to consider in the future.