View previous topic :: View next topic
|
Author |
Message |
krsenthil85
New User
Joined: 31 Aug 2007 Posts: 55 Location: bangalore
|
|
|
|
Hi,
I have requirement to split single file into multiple files, the input file is 80 byte EDI file and input file looks like below
Code: |
ISA*00* *00* *16*055169452TST2 *12*8006670959T *150602*091
7*U*00305*000000001*0*P*:~GS*FA*055169452TST2*NIUS271JDWRA*150602*0917*1*X*00305
7*U*00305*000000001*0*P*:~GS*FA*055169452TST2*NIUS271JDWRA*150602*0917*1*X*00305
0~ST*997*000000001~AK1*RA*250~AK9*A*1*1*1~SE*4*000000001~GE*1*1~IEA*1*000000001~
ISA*00* *00* *16*055169452TST2 *12*8006670959T *150602*091
7*U*00305*000000002*0*P*:~GS*FA*055169452TST2*NIUS271JDWRA*150602*0917*2*X*00305
0~ST*997*000000002~AK1*RA*252~AK9*A*1*1*1~SE*4*000000002~GE*1*2~IEA*1*000000002~
ISA*00* *00* *16*055169452TST2 *12*8006670959T *150602*091
7*U*00305*000000003*0*P*:~GS*FA*055169452TST2*NIUS271JDWRA*150602*0917*3*X*00305
0~ST*997*000000003~AK1*RA*251~AK2*820*000001730~AK3*BPR*2~AK4*14*569*2~AK5*R*5~A
K9*R*1*1*0~SE*8*000000003~GE*1*3~IEA*1*000000003~ |
Whenever it encounters a string 'ISA*' at position 1,4 it has to put it into the next file and so on... So the output file should looks like below
File 1
Code: |
ISA*00* *00* *16*055169452TST2 *12*8006670959T *150602*091
7*U*00305*000000001*0*P*:~GS*FA*055169452TST2*NIUS271JDWRA*150602*0917*1*X*00305
7*U*00305*000000001*0*P*:~GS*FA*055169452TST2*NIUS271JDWRA*150602*0917*1*X*00305
0~ST*997*000000001~AK1*RA*250~AK9*A*1*1*1~SE*4*000000001~GE*1*1~IEA*1*000000001~ |
File2
Code: |
ISA*00* *00* *16*055169452TST2 *12*8006670959T *150602*091
7*U*00305*000000002*0*P*:~GS*FA*055169452TST2*NIUS271JDWRA*150602*0917*2*X*00305
0~ST*997*000000002~AK1*RA*252~AK9*A*1*1*1~SE*4*000000002~GE*1*2~IEA*1*000000002~ |
File3
Code: |
ISA*00* *00* *16*055169452TST2 *12*8006670959T *150602*091
7*U*00305*000000003*0*P*:~GS*FA*055169452TST2*NIUS271JDWRA*150602*0917*3*X*00305
0~ST*997*000000003~AK1*RA*251~AK2*820*000001730~AK3*BPR*2~AK4*14*569*2~AK5*R*5~A
K9*R*1*1*0~SE*8*000000003~GE*1*3~IEA*1*000000003~ |
Could you please proivde the either a sort card or Filemgr step to do this through JCL. |
|
Back to top |
|
|
RahulG31
Active User
Joined: 20 Dec 2014 Posts: 446 Location: USA
|
|
|
|
Do you know how many files you want ?
What is your approach ?
Have you searched the forum first?
. |
|
Back to top |
|
|
krsenthil85
New User
Joined: 31 Aug 2007 Posts: 55 Location: bangalore
|
|
|
|
The number of files is based on the ISA records presented in input file. So in the above sample file there are 3 ISA records, hence I need three output files.
I already search it in the forum for similar discussion and did not find it. |
|
Back to top |
|
|
RahulG31
Active User
Joined: 20 Dec 2014 Posts: 446 Location: USA
|
|
|
|
Ok. So, do you think that Sort can actually create output files through JCL depending on the number of your input *ISA records ?
Have you really thought about it ?
Did you read this : ibmmainframes.com/about60113.html
. |
|
Back to top |
|
|
krsenthil85
New User
Joined: 31 Aug 2007 Posts: 55 Location: bangalore
|
|
|
|
Hi,
Could some please provide solution for this |
|
Back to top |
|
|
RahulG31
Active User
Joined: 20 Dec 2014 Posts: 446 Location: USA
|
|
|
|
Quote: |
The number of files is based on the ISA records presented in input file. |
What is the maximum number of ISA records that your file can have? (if there is any)
1000, 2000, .. , 10000 ?
. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
You've not really given very good answers to what you were asked.
How many ISA can there be, as a maximum? No-one is asking how many are in your example.
The principle is simple. Use WHEN=GROUP to identify your groups of records, and PUSH an ID. In OUTFIL, INCLUDE for the particular ID for each group.
However, you may be meaning you need something much more complex. We're not going to produce something and have you say "No, because...". You have to tell us everything first. |
|
Back to top |
|
|
krsenthil85
New User
Joined: 31 Aug 2007 Posts: 55 Location: bangalore
|
|
|
|
Hi,
Maximum it can have upto 10 ISA in input file. |
|
Back to top |
|
|
RahulG31
Active User
Joined: 20 Dec 2014 Posts: 446 Location: USA
|
|
|
|
Quote: |
Ok. So, do you think that Sort can actually create output files through JCL depending on the number of your input *ISA records ?
Have you really thought about it ?
Did you read this : ibmmainframes.com/about60113.html
. |
The link in my earlier post should have given you enough hints on how to proceed. If you had thought/worked on it then, you would have got the solution by now. Asking for a solution before even trying yourself (even after hints were given) is not good on your part (to put it mildly). |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Code: |
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,
BEGIN=(1,7,CH,EQ,C'ISA*00*'),
PUSH=(81:ID=2))
OUTFIL FNAMES=X1,INCLUDE=(81,2,CH,EQ,C'01'),
BUILD=(1,80)
OUTFIL FNAMES=X2,INCLUDE=(81,2,CH,EQ,C'02'),
BUILD=(1,80)
...
OUTFIL FNAMES=X9,INCLUDE=(81,2,CH,EQ,C'09'),
BUILD=(1,80)
OUTFIL FNAMES=XX,
SAVE,
BUILD=(1,80) |
When you have three ISAs, you'll have seven empty files. You can delete those. There are examples of that here.
If you know how many groups there are, you can generate the code and JCL. |
|
Back to top |
|
|
|