Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Need help in spiltting files

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Need help in spiltting files
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    Post subject:
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    Post subject:
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: 2422
Location: Netherlands, Amstelveen

PostPosted: Tue May 10, 2011 3:41 pm    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Tue May 10, 2011 4:47 pm    Post subject: Reply to: Need help in spiltting files
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://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    Post subject:
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: 2422
Location: Netherlands, Amstelveen

PostPosted: Tue May 10, 2011 5:07 pm    Post subject:
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    Post subject:
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: 2422
Location: Netherlands, Amstelveen

PostPosted: Tue May 10, 2011 5:59 pm    Post subject:
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: 578
Location: USA

PostPosted: Tue May 10, 2011 7:28 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 8 Thu Dec 01, 2016 8:28 pm
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
This topic is locked: you cannot edit posts or make replies. How to use 2 input files in control c... Gunapala CN DFSORT/ICETOOL 23 Thu Oct 13, 2016 3:42 pm
No new posts Adding records from two files into on... shiitiizz SYNCSORT 4 Mon Sep 19, 2016 8:41 pm
No new posts Icetool or Joinkeys example to compar... ishant chauhan DFSORT/ICETOOL 21 Sat Aug 20, 2016 2:40 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us