I know this has been posted multiple times in the forum and I've tried the following solution but I am not getting the desired output.
So, here is my requirement:
I've a VB file with lenght of 11054. The last records of the VB file is the trailer record. The trailer record consists of a Date and the count. Both are in Packed Decimal format. The rest of the fields in the Trailer are just blanks or spaces.
If you don't have DFSORT, please don't post in the DFSORT forum, Your topic has been moved to the JCL forum, where non-DFSORT sort questions live.
If you don't have DFSORT, why do you use it in your stepname?
Why are some of the control cards under the subsys and others not?
The whole thing can be done in one step, is there a need to split it?
Allthough you append temporary data to the end of fxied-length records, you do it at the beginning of variable-length records to preserve their variable-ness of length.
In addition to making all the records the same length when you extend them, you also tell the sysout to do that with the IFOUTLEN.
Your data remains unchanged because you made no attempt to change it.
To specify SORTIN on the OUTFIL is a bad idea. In a COPY operation, it is eeven worse.
From the output you show, the rest of the data on the trailer is not blanks or spaces but "high values", hexadecimal FF.
When finding a set of sort Control Cards, it is good to find out what they are doing.
Do you, reliably, have the date somewhere else in the data, like in the header? If you do, then the trailer can be reconstructed in OUTFIL using th in-built TRAILER1 and COUNT.
If not, then generally the same approach as you have:
Create a sequence number at the start of the record. Run this on your test data and look at the output. Note that the output is variable-length. Look at the output from your existing Control Cards and note that it is fixed at the maximum LRECL.
I now see that there is nothing on the trailer to identify it as a trailer, is there? You test for 02 was to try to compare to the first part of the date? You do realise that will only work for the next 86 years?
IFTHEN=(WHEN=(13,1,CH,EQ,X'02'), => note 13 because of the extra 8 bytes
Note, I've not attempted to run this, so attempt to fix any errors yourself without asking back here. Ensure that you understand what everything is doing (read the manual, check example, ask colleagues). If still have problems, ask here. Let us know how it goes, please.
I had noticed that the trailer had High values after the Count and no other records have High values. So, I have used that as a condition to search for the High value.
Bill, thanks for all your support.
Are all your input records the same length? They are now on the output.
The data on each of the record may not take up the entire 11050 lenght. We've a trailer section on the records and the data in their will vary for each record. So, it may not be of the same length.
So, yes I will want to retain the input lenght. How do I do that?
I tried using to do the sorting within this OUTREC but was not able to achieve it. So, I had to do it in 2 steps. How do I do it in 1 step?