View previous topic :: View next topic
|
Author |
Message |
Hari1282
New User
Joined: 31 Mar 2008 Posts: 7 Location: Pune, INDIA
|
|
|
|
Hi All,
I have one flat file it consists of Header, records and Trailer.
Here my requirement is I want to copy Header in one file Records in one file and Trailer in one file.
Is it possible by using sort utility in JCL. |
|
Back to top |
|
|
shrivatsa Warnings : 1 Active User
Joined: 17 Mar 2006 Posts: 174 Location: Bangalore
|
|
|
|
Can you please provide your sample input file...? |
|
Back to top |
|
|
acevedo
Active User
Joined: 11 May 2005 Posts: 344 Location: Spain
|
|
|
|
yes it's posible, search for OUTFIL.
Code: |
OUTFIL FILES=01,INCLUDE=(CONDITIONFORHEADER)
OUTFIL FILES=02,INCLUDE=(CONDITIONFORDETAILS)
OUTFIL FILES=03,INCLUDE=(CONDITIONFORTRAILER) |
|
|
Back to top |
|
|
Hari1282
New User
Joined: 31 Mar 2008 Posts: 7 Location: Pune, INDIA
|
|
|
|
Hi All,
Below is the example for my input file.
AC325644120080410130356 ----- Header
4521356 0 200804090001 ----- Record 1
4512345 1 200803310000 ----- Record 2
AC325644120080410130628 ----- Trailer
Now I want to split above file into three output files such as
Header in File 1
Record 1 and Record 2 in File 2
Trailer in File 3 |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
Is this because you want to sort the records between the header and trailer but keep the header / trailer seperate to rebuild the file after sorting ? |
|
Back to top |
|
|
Hari1282
New User
Joined: 31 Mar 2008 Posts: 7 Location: Pune, INDIA
|
|
|
|
Yes excatly. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
There is a search button at the top of the page, please use it as this topic has been discussed and answered with the correct code supplied. |
|
Back to top |
|
|
sril.krishy
Active User
Joined: 30 Jul 2005 Posts: 183 Location: hyderabad
|
|
|
|
Hari1282,
Please see the below code.
Code: |
//PS020 EXEC PGM=ICETOOL
//SYSOUT DD SYSOUT=*
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD *
AC325644120080410130356 ----- HEADER
4521356 0 200804090001 ----- RECORD 1
4512345 1 200803310000 ----- RECORD 2
AC325644120080410130628 ----- TRAILER
AC325644120080410130356 ----- HEADER
4521356 0 200804090001 ----- RECORD 1
4512345 1 200803310000 ----- RECORD 2
AC325644120080410130628 ----- TRAILER
//OUT1 DD SYSOUT=*
//OUT2 DD SYSOUT=*
//OUT3 DD SYSOUT=*
//TMP1 DD DSN=&&TA,UNIT=SYSDK,SPACE=(CYL,(5,5)),DISP=(,PASS)
//TOOLIN DD *
SORT FROM(IN) USING(CTL1)
SORT FROM(TMP1) USING(CTL2)
//CTL1CNTL DD *
SORT FIELDS=COPY
OUTFIL FNAMES=TMP1,INCLUDE=(1,2,CH,EQ,C'AC'),
OUTREC=(1,40)
OUTFIL FNAMES=OUT2,INCLUDE=(1,2,CH,NE,C'AC'),
OUTREC=(1,40)
//CTL2CNTL DD *
SORT FIELDS=COPY
OUTFIL FNAMES=(OUT1,OUT3),SPLIT
/*
|
The OUT1 output :
Code: |
AC325644120080410130356 ----- HEADER
AC325644120080410130356 ----- HEADER
|
Code: |
The OUT2 output :
4521356 0 200804090001 ----- RECORD 1
4512345 1 200803310000 ----- RECORD 2
4521356 0 200804090001 ----- RECORD 1
4512345 1 200803310000 ----- RECORD 2
|
The OUT3 output :
Code: |
AC325644120080410130628 ----- TRAILER
AC325644120080410130628 ----- TRAILER
|
Thanks
Krishy |
|
Back to top |
|
|
Hari1282
New User
Joined: 31 Mar 2008 Posts: 7 Location: Pune, INDIA
|
|
|
|
Hi Krishy,
Thanks a lot yaar.
Can I give PS file name instead of giving all the records in input file? |
|
Back to top |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
hari,
Quote: |
Can I give PS file name instead of giving all the records in input file? |
Yes, You can . |
|
Back to top |
|
|
pavankumarhassaji
New User
Joined: 20 Aug 2007 Posts: 11 Location: Canada
|
|
|
|
Hi,
if your requirement is to sort records of a file between header and trailer.
Then u need not split the file, u can directly do that using IFTHEN OVERLAY of ICETOOL
copy the file into a tempory file,
while copying that
overlay '0' for the header record at end of record say at 81st position
overlay '1' for the detail record same position as above
overlay '2' for the trailer record same position as above
now in the sort card give the 81st postion as primary key and secondary key as the sort field of detail record.
if u want any other info regarding IFTHEN OVERLAY, refer ICETOOL manual or SORT TRICS book, which u can find in this forum stickys
Thanks,
Pavan Hassaji. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
To repeat what Expat posted. . . .
Quote: |
Is this because you want to sort the records between the header and trailer but keep the header / trailer seperate to rebuild the file after sorting ? |
To repeat what Hari1282 posted. . . .
To repeat what Expat posted. . . .
Quote: |
There is a search button at the top of the page, please use it as this topic has been discussed and answered with the correct code supplied. |
There is no need to split the input to accomplish the requirement.
Hari, i'd suggest you become familiar and comfortable with the "SEARCH" feature (near the top of the page).
Here is one of the topics you could have found:http://ibmmainframes.com/viewtopic.php?t=23773&highlight=detail+header+trailer |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
With z/OS DFSORT V1R5 PTF UK90013 (July, 2008), you can now use DATASORT to sort the records between a header and a trailer quite easily.
For complete details on the new DATASORT function and the other new functions available with PTF UK90013, see:
Use [URL] BBCode for External Links |
|
Back to top |
|
|
|