View previous topic :: View next topic
|
Author |
Message |
Musab Ahmed
New User
Joined: 10 Dec 2012 Posts: 37 Location: India
|
|
|
|
Hello All,
I have a requirement in my project and would like to know if it is possible using DFSORT.
I have a file as shown below - 80 rec len. H-header, T-trailer, 9-data. The file contains header-trailer groups with detail records in between. eg.
H
T
H
9
T
H
9
9
T
H
9
T
I need to spilt this file into two. The threshold value is 7. It means that the first file should contain the records with record count less than 7 and also only upto the latest HT group. ie if the seventh record is either H or 9, then only records upto the latest T should be present in the first file and the remaining should be pushed to file2.
I have written a SELCOPY program to achieve this. But just wanted to know if it can be done using DFSORT.
Output should be
File 1
H
T
H
9
T
File 2
H
9
9
T
H
9
T |
|
Back to top |
|
|
Musab Ahmed
New User
Joined: 10 Dec 2012 Posts: 37 Location: India
|
|
|
|
Since there are no replies,
I guess this is not possible. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
It is less that four and a quarter hours since you originally posted and yet you decry the lack of response so quickly.
People that respond do so in THEIR time, not yours. They also respond for FREE
Also remember that a lot of the respondants live in a different time zone than you do. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
Back to top |
|
|
Musab Ahmed
New User
Joined: 10 Dec 2012 Posts: 37 Location: India
|
|
|
|
i didnt mean to be rude..
dont get so sensitive expat.
bad to your health. |
|
Back to top |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1249 Location: Richfield, MN, USA
|
|
|
|
If you've seen as many "impatient" posts as some of the rest of us over the years, you might well have responded in the same manner as expat. |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Musab Ahmed wrote: |
Since there are no replies,
I guess this is not possible. |
As others already mentioned, not every one works in your time zone or round the clock without vacation.
Yes it is quite simple task for DFSORT if you follow the steps listed below
1. Using INREC IFTHEN=(WHEN=INIT, overlay a 8 byte sequence number at position 81.
2. On the same Inrec use IFTHEN=(WHEN=GROUP, and check for seqnum=7 and the 1st byte as either "H" or "9" as BEGIN parms and check for "T" on the END parm and PUSH the sequence at 81 onto position 81. By doing so you have set the keys to be split.
3. Using OUTFIL INCLUDE with sequence number at 81 LE 7 write them file1 and BUILD just the 80 bytes. For File2 you can use SAVE parm on outfil to write out the rest of the records. |
|
Back to top |
|
|
|