View previous topic :: View next topic
|
Author |
Message |
sauthur
New User
Joined: 26 Nov 2013 Posts: 4 Location: USA
|
|
|
|
Hi,
I have a VB file with Multiple header+detail records+trailer groups. Group should not be changed or sorted.
The file will contain say 51000 groups it need to be split this into two files one with 25000 groups and balance 26000 groups to second file. Two output file need to be in VB format
Please suggest me a sort |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3051 Location: NYC,USA
|
|
|
|
You might wants to see, and look for "Sort detail records between headers and trailers"
I believe you would want to sort the details between the headers trailers.
ftp.software.ibm.com/storage/dfsort/mvs/sorttrck.pdf
And provide sample input data and what is the output expected whith what logic.
Thanks,
Rohit |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Answer all the questions.
1. How do you identify the Header? Is there an indicator? If so what is the position and format of the indicator?
2. How do you identify the detail record? Is there an indicator? If so what is the position and format of the indicator?
3. How do you identify the trailer record? Is there an indicator? If so what is the position and format of the indicator?
4. Is the number of groups constant? or do you need to dynamically find out as to how many group exist and then divide the input file into 2 files? or do you want the split to happen for every 25,000 groups?
5. Last but not least run the following Job and show us the complete sysout, so that we can determine the level of DFSORT you have at your shop.
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
//* |
|
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Rohit,
Please understand the question before you suggest a solution. OP clearly mentioned he does NOT want to SORT the groups. Why would you suggest a sorting Groups Solution?
sauthor wrote: |
Group should not be changed or sorted. |
It would make sense if had you suggested "Include or omit groups of records" trick instead of "Sort detail records between headers and trailers"
I appreciate your help, if you are suggesting something way off it is double the work for me. |
|
Back to top |
|
|
sauthur
New User
Joined: 26 Nov 2013 Posts: 4 Location: USA
|
|
|
|
Its an EDI message. HD is the identifier for header TRL is the trailer. But no identifier for detail records. No detail record start with HD or TRL. All start at 1. |
|
Back to top |
|
|
sauthur
New User
Joined: 26 Nov 2013 Posts: 4 Location: USA
|
|
|
|
1. How do you identify the Header? Is there an indicator? If so what is the position and format of the indicator?
Ans: Header Starts with 'HD' start at 1
2. How do you identify the detail record? Is there an indicator? If so what is the position and format of the indicator?
Ans: No Identifier But start at position 1 (Not HD or TRL)
3. How do you identify the trailer record? Is there an indicator? If so what is the position and format of the indicator?
Ans: Trailer Start with TRL at position 1
4. Is the number of groups constant? or do you need to dynamically find out as to how many group exist and then divide the input file into 2 files? or do you want the split to happen for every 25,000 groups?
Ans: Only First file is used for Processing which can have max 25000 Message groups. All the message groups beyond 25000 should go to second file which is kind of back up.
If say input file has only 20000 message groups then all should go to first file |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DISP=SHR,DSN=Your Input VB File
//OUT1 DD SYSOUT=*
//OUT2 DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,8X,5)),
IFTHEN=(WHEN=GROUP,BEGIN=(13,2,CH,EQ,C'HD'),END=(13,3,CH,EQ,C'TRL'),
PUSH=(5:ID=8))
OUTFIL FNAMES=OUT1,INCLUDE=(5,8,ZD,LE,25000),BUILD=(1,4,13)
OUTFIL FNAMES=OUT2,SAVE,BUILD=(1,4,13)
//* |
|
|
Back to top |
|
|
sauthur
New User
Joined: 26 Nov 2013 Posts: 4 Location: USA
|
|
|
|
Thanks a lot, It worked as perfect |
|
Back to top |
|
|
|