View previous topic :: View next topic |
Author |
Message |
Rahull Beginner
Joined: 29 Jan 2004 Posts: 62 Topics: 19
|
Posted: Wed May 16, 2007 11:24 am Post subject: Trailer Issue! |
|
|
Hi,
Please help me figure out how to obtain the below result:
Problem : I have an input file with header, detail and trailer record. File length is 80 byte and record layout for trailer is :
Code: |
05 W-Z5BS-TRL-SEG-ID PIC XXX VALUE '999'
05 W-Z5BS-TRL-REC-COUNT PIC 9(7).
05 FILLER PIC X(70) VALUE SPAC
|
Trailer count = Number of detail records excluding header record.
I need to run a SORT utility and concatenate the above file with another flat file (LRECL = 80) with all detail records.
Final Output = Header + Detail records original + Detail records from second file + Trailer record (Updated with new record count).
Sample input File 1 : Code: |
51070516070515 (Header)
5128274967HOL20070603 (Detail 1)
5144358641HOL20070511 (Detail 2)
9990000002 (Trailer)
|
Input file 2: Code: |
5106027397HOA20070613 (Detail 3)
5106027398HOA20070613 (Detail 4)
|
Output file: Code: |
51070516070515 (Header)
5128274967HOL20070603 (Detail 1)
5144358641HOL20070511 (Detail 2)
5106027397HOA20070613 (Detail 3)
5106027398HOA20070613 (Detail 4)
9990000004 (Trailer) |
|
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12359 Topics: 75 Location: San Jose
|
Posted: Wed May 16, 2007 12:13 pm Post subject: |
|
|
Rahull,
Try this job.
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=Your input file 1,
// DISP=SHR
// DD DSN=Your input file 2,
// DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OMIT COND=(1,3,CH,EQ,C'999')
SORT FIELDS=COPY
OUTFIL REMOVECC,
TRAILER1=('999',COUNT-1=(M11,LENGTH=7),80:X)
/*
|
Hope this helps...
Cheers
Kolusu _________________ Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
Nic Clouston Advanced
Joined: 01 Feb 2007 Posts: 1075 Topics: 7 Location: At Home
|
Posted: Wed May 16, 2007 12:55 pm Post subject: |
|
|
Quote: |
I need to run a SORT utility
|
So why is this posted in the JCL section and not in the Utilities section? I was looking forward to a nice juicy JCL problem to try resolve _________________ Utility and Program control cards are NOT, repeat NOT, JCL. |
|
Back to top |
|
|
CraigG Intermediate
Joined: 02 May 2007 Posts: 202 Topics: 0 Location: Viginia, USA
|
Posted: Wed May 16, 2007 2:34 pm Post subject: |
|
|
Nic Clouston wrote: | Quote: |
I need to run a SORT utility
|
So why is this posted in the JCL section and not in the Utilities section? I was looking forward to a nice juicy JCL problem to try resolve |
Some people don't know the difference between JCL and program (utility)control cards. |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12359 Topics: 75 Location: San Jose
|
Posted: Wed May 16, 2007 6:23 pm Post subject: |
|
|
Quote: |
So why is this posted in the JCL section and not in the Utilities section? I was looking forward to a nice juicy JCL problem to try resolve
|
Nic,
He is one of the Elite posters who does not post a feedback for the solutions he received in here. we will just be remembered when he gets another problem, till then ....
Kolusu _________________ Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
|
|