IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Need help in spiltting files


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Amb

New User


Joined: 12 Mar 2010
Posts: 64
Location: India

PostPosted: Tue May 10, 2011 11:03 am
Reply with quote

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
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue May 10, 2011 2:42 pm
Reply with 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?

And as usual,
What is input\output LRECL\RECFM?
Back to top
View user's profile Send private message
Amb

New User


Joined: 12 Mar 2010
Posts: 64
Location: India

PostPosted: Tue May 10, 2011 3:29 pm
Reply with quote

@ Escapa

Input LRECL = 80
Output LRECL = 80
RECFM for input as well as output = FB

'JOB' will occur only once.

Code:
 Job2222 JOB mmm 
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Tue May 10, 2011 3:41 pm
Reply with quote

Quote:

'JOB' will occur only once.


Escapa,

have fun.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue May 10, 2011 3:53 pm
Reply with quote

PeterHolland wrote:
Quote:

'JOB' will occur only once.


Escapa,

have fun.

Yeah.. really... icon_lol.gif icon_lol.gif
....

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
View user's profile Send private message
Amb

New User


Joined: 12 Mar 2010
Posts: 64
Location: India

PostPosted: Tue May 10, 2011 4:39 pm
Reply with quote

yes.. But I want to split the input file into separate files when I encounter the 'JOB' keyword.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue May 10, 2011 4:45 pm
Reply with quote

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.... icon_evil.gif icon_evil.gif

Please read through whole chain carefully and try to respond...
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Tue May 10, 2011 4:47 pm
Reply with quote

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
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue May 10, 2011 4:54 pm
Reply with quote

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.. icon_sad.gif

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... icon_neutral.gif
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Tue May 10, 2011 5:07 pm
Reply with quote

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
View user's profile Send private message
Amb

New User


Joined: 12 Mar 2010
Posts: 64
Location: India

PostPosted: Tue May 10, 2011 5:33 pm
Reply with quote

@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
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Tue May 10, 2011 5:59 pm
Reply with quote

You never mentioned your input file has mixed case, so Job11 could have been JOB11.
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Tue May 10, 2011 7:28 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Merge two VSAM KSDS files into third ... JCL & VSAM 6
No new posts Joinkeys - 5 output files DFSORT/ICETOOL 7
No new posts How to append a PS file into multiple... JCL & VSAM 3
Search our Forums:

Back to Top