|
View previous topic :: View next topic
|
| Author |
Message |
kmk2mani
New User

Joined: 08 Jul 2010 Posts: 12 Location: United Kingdom
|
|
|
|
Hi,
I am new to this forum. I have a requirement where in I will have to split one file into five files with trailer in it. My input file will have 5 sets of Detail and trailer records and need to be split into 5 files with each set of detail and trailer in each file
INPUT:
D
D
D
D
T
D
D
T
D
T
D
T
D
D
T
OUTPUT Expected:
OUTPUT1:
D
D
D
D
T
OUTPUT2:
D
D
T
OUTPUT3:
D
T
OUTPUT4:
D
T
OUTPUT5:
D
D
T
This is really an urgent requirement. Any help on this would really be appreciated.
Thanks,
Mani. |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello and welcome to the forum,
| Quote: |
| This is really an urgent requirement. |
Sorry, we don't do urgent. . . However, if this is truly urgent, this would take less than an hour of coding. . .
Very similar topics have been posted and have solutions posted. Suggest you become familiar with the forum SEARCH (above in the blue line/bar).
Which sort product is used on your system? |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Mani,
You can use a DFSORT job like the following to do what you asked for. I assumed your input file has RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes.
| Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (FB/80)
//OUT1 DD DSN=... outnput file1 (FB/80)
//OUT2 DD DSN=... outnput file2 (FB/80)
//OUT3 DD DSN=... outnput file3 (FB/80)
//OUT4 DD DSN=... outnput file4 (FB/80)
//OUT5 DD DSN=... outnput file5 (FB/80)
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,END=(1,1,CH,EQ,C'T'),PUSH=(81:ID=1))
OUTFIL FNAMES=OUT1,INCLUDE=(81,1,ZD,EQ,1),BUILD=(1,80)
OUTFIL FNAMES=OUT2,INCLUDE=(81,1,ZD,EQ,2),BUILD=(1,80)
OUTFIL FNAMES=OUT3,INCLUDE=(81,1,ZD,EQ,3),BUILD=(1,80)
OUTFIL FNAMES=OUT4,INCLUDE=(81,1,ZD,EQ,4),BUILD=(1,80)
OUTFIL FNAMES=OUT5,INCLUDE=(81,1,ZD,EQ,5),BUILD=(1,80)
/*
|
|
|
| Back to top |
|
 |
kmk2mani
New User

Joined: 08 Jul 2010 Posts: 12 Location: United Kingdom
|
|
|
|
| Thank you Frank! The above code is writing only the trailer record in the output file. I need the outfile with Detail as well as trailer record. Could you help? |
|
| Back to top |
|
 |
enrico-sorichetti
Superior Member

Joined: 14 Mar 2007 Posts: 10903 Location: italy
|
|
|
|
Frank snippet behaves as requested!
what did You change ? |
|
| Back to top |
|
 |
expat
Global Moderator

Joined: 14 Mar 2007 Posts: 8798 Location: Welsh Wales
|
|
|
|
| Probably best that you post the sysout from the run to let us see exactly what has happened with the run. |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Mani,
My job does what you asked for based on the input you showed and the expected output you showed. If you're not getting the details records, then your input is either different than what you said it was, or you changed my job in some way.
Your input example shows D records followed by a T record for each group where D and T are in position 1. Is that what it really looks like?
If not, show a better example.
You would have to show me YOUR actual job and JES messages for the run before I could try to figure out what you did wrong.
| Quote: |
| This is really an urgent requirement. |
And yet, you didn't bother to show any useful information when you said it didn't work for you. |
|
| Back to top |
|
 |
kmk2mani
New User

Joined: 08 Jul 2010 Posts: 12 Location: United Kingdom
|
|
|
|
Frank,
Sorry that was my bad. there was a small change in my JCL compared to yours but when I was trying just with your JCL it worked.
Thanks a ton for your efforts!  |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|