View previous topic :: View next topic
|
Author |
Message |
Amb
New User
Joined: 12 Mar 2010 Posts: 64 Location: India
|
|
|
|
I have a file as follows:
Code: |
Job11 JOB aaaaa
ccccccccccccccccc
ddddddddddddddd
Job2222 JOB mmm
mmmmmmmmmm
kkkkkkkkkkkkkkkk
Job3 JOB zzzzzzzzz
aaaaaaaaaaaaaaaa
qqqqqqqqqqqqqqqq |
My requirement is whenever I find the key word 'JOB' i should start writing the data into a new file.
So for the above I should get three output file
File 1:
Code: |
Job11 JOB aaaaa
ccccccccccccccccc
ddddddddddddddd |
File 2:
Code: |
Job2222 JOB mmm
mmmmmmmmmm
kkkkkkkkkkkkkkkk |
File 3:
Code: |
Job3 JOB zzzzzzzzz
aaaaaaaaaaaaaaaa
qqqqqqqqqqqqqqqq |
Can any one suggest me how can I do this using a SORT or ICETOOL? [/code] |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Is number of occurences of 'JOB' in the input file are fixed?
if it is varying, what would be maximum number of times 'JOB' can occur in the input?
And as usual,
What is input\output LRECL\RECFM? |
|
Back to top |
|
|
Amb
New User
Joined: 12 Mar 2010 Posts: 64 Location: India
|
|
|
|
@ Escapa
Input LRECL = 80
Output LRECL = 80
RECFM for input as well as output = FB
'JOB' will occur only once.
|
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
Quote: |
'JOB' will occur only once.
|
Escapa,
have fun. |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
PeterHolland wrote: |
Quote: |
'JOB' will occur only once.
|
Escapa,
have fun. |
Yeah.. really...
....
Amb.. if 'JOB' will occur only once in input file then..
your input is what you want as output.... No juggling required... |
|
Back to top |
|
|
Amb
New User
Joined: 12 Mar 2010 Posts: 64 Location: India
|
|
|
|
yes.. But I want to split the input file into separate files when I encounter the 'JOB' keyword. |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Amb wrote: |
yes.. But I want to split the input file into separate files when I encounter the 'JOB' keyword. |
My day is good so far... Don't spoil ... This is irritating me....
Please read through whole chain carefully and try to respond... |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
Quote: |
But I want to split the input file into separate files when I encounter the 'JOB' keyword |
.
Sambhaji question seemed clear to me...
how many occurrences of the <separator> will be there
if the number is fixed then it could be possible to have a static job
if the number is unknown then the only way is a two step approach
step1 scan the input file and build a jcl with the proper number of dd/output files
and submit iy thru the internal reader
the issue of dynamic splitting has been discussed so many times that it should be easy for You
to search for solutions or at least be able to understand what is being asked
see here also here for the full details
ftp.software.ibm.com/storage/dfsort/mvs/sorttrck.pdf |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
If you got fixed number of jobs keywords already known before..
Below is the template step..
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
Job11 JOB aaaaa
ccccccccccccccccc
ddddddddddddddd
Job2222 JOB mmm
mmmmmmmmmm
kkkkkkkkkkkkkkkk
Job3 JOB zzzzzzzzz
aaaaaaaaaaaaaaaa
qqqqqqqqqqqqqqqq
//OUT1 DD SYSOUT=*
//OUT2 DD SYSOUT=*
//OUT3 DD SYSOUT=*
//SYSIN DD *
OPTION COPY,EQUALS
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'Job'),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)
/*
|
@Enrico, I was just expecting answers to these queries..
Quote: |
Is number of occurences of 'JOB' in the input file are fixed?
if it is varying, what would be maximum number of times 'JOB' can occur in the input?
|
On top of this.. OP is also saying..
Quote: |
'JOB' will occur only once.
|
But input he has shown doen't seems like that... |
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
Im still not understanding that people stating the following :
Occupation: Software Engineer
Mainframe Skills: Micro Focus Cobol, Delta Cobol, COBOL, JCL, VSAM, DB2, CLIST, ChangeMan, InfoMan, REXX
and showing a total lack of knowledge are getting answered. |
|
Back to top |
|
|
Amb
New User
Joined: 12 Mar 2010 Posts: 64 Location: India
|
|
|
|
@Sambhaji
I was mentioning about the keyword 'JOB' and not 'Job11' or 'Job2222' or 'Job3'.
As seen in the input file the occurance of the string 'JOB' is only once but however the position of this string 'JOB' is not fixed, thats why I had the above querry. |
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
You never mentioned your input file has mixed case, so Job11 could have been JOB11. |
|
Back to top |
|
|
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
Amb,
See if this works,you only had to tweak logic provided by Escapa...
Code: |
//SYSIN DD *
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,80,SS,EQ,C'JOB'),
PUSH=(81:ID=8))
OPTION COPY,EQUALS
OUTFIL FNAMES=OUT1,INCLUDE=(81,8,ZD,EQ,1),
BUILD=(1,80)
OUTFIL FNAMES=OUT2,INCLUDE=(81,8,ZD,EQ,2),
BUILD=(1,80)
OUTFIL FNAMES=OUT3,INCLUDE=(81,8,ZD,EQ,3),
BUILD=(1,80)
/* |
I am still not sure if you correctly understood and answered Escapa's question on max. JOB occurences in the input file. Because you answered his question saying it occurs only once but your example shows JOB 3 times in the entire input file and that matches with your output. Original question was max. JOB occurences in the entire input file because that decided number of output DD you would have to code in JCL. Original question did not ask JOB occurence at the record level. Hope that's clear now.
Thanks, |
|
Back to top |
|
|
|