Assuming each of your fields to be of length 5 and no spaces in between these 5 FIELDS (SEQ_ID, AMOUNT, TRAN_ID, PRI_CUS and SEC_CUS )
You can customize below jcl to include spaces between these fields.
In first step, first 4 fields SEQ_ID, AMOUNT, TRAN_ID and PRI_CUS from all the records are written to &&T1 temporary dataset. Also all the records in the input file which do not have spaces in fifth field (col21-25 i.e secondary customer), first three fields SEQ_ID, AMOUNT , TRAN_ID (these together occupy col1-15) and fifth field SEC_CUS (col 21-25) are extracted from these records and &&T2 file is created.
In the second step, &&t1 and &&t2 are merged and sorted to give data in OUTPUT file HLQ.YOUR.OUTPUT.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Bhaskar,
Ajay's "solution" is ridiculously inefficient. You don't need four passes over the data to do what you want - you can do it in one pass with the following DFSORT job:
I never used the '/' operator and it did not cross my mind.
Please let me know if i am right,
Quote:
BUILD=(1,29,/,1,22,31,7)
causes two o/p records to be written from one input record:
1) col1 to 29 to be written to first output record.
2) col1-22 followed by col 31-37 to second o/p record.
Yes, my solution is less efficient as compared since it requires more no of passes. But it does the job.
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
Hello,
Quote:
Yes, my solution is less efficient as compared since it requires more no of passes. But it does the job.
Most organizations would not find this an acceptable answer for a Production solution.
For a one-time situation, maybe, but not as a philosophy.
/rant on
This is one of the major issues facing management today. There are far too many "developers" who have no idea how to do their job properly, so anything that happens to run to end-of-job is promoted and used. It is creating a performance and maintenance nightmare.
/rant off
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Ajay,
Yes, that's what the BUILD statement does and IFOUTLEN=60 ensures that the output records are padded on the right with blanks to 60 bytes.
Quote:
Yes, my solution is less efficient as compared since it requires more no of passes. But it does the job.
Actually, your "solution" doesn't even do the job! It has many problems. STEP1 is missing the required //SYSOUT DD statement. STEP2 is missing the required //TOOLMSG, //DFSMSG and //TOOLIN statements. The OMIT operand has a syntax error (missing format in OMIT). So as shown your job wouldn't even complete successfully.
If it did complete, it would give an output LRECL of 20 when the OP asked for 60.
I don't even see what you're trying to do - it doesn't seem to make any sense given that there was supposed to be a comparison between the two ZD fields and you don't have any such comparison.