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
 

 

Split the input file between 2 specific words

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
chavansu

New User


Joined: 20 Nov 2008
Posts: 14
Location: California USA

PostPosted: Wed Apr 01, 2009 5:10 pm    Post subject: Split the input file between 2 specific words
Reply with quote

Hi,
I have a file with records having specific word at certain intervals. I want to split this file into multiple output files as shown below.

Input file :
Code:
IN1234ABC
455656SDASDF
77789J JJJJKLL
IN564565423413
B M M LM786788
786HHHHJH

Output files will be
1st file
Code:
IN1234ABC
455656SDASDF
77789J JJJJKLL

2nd file
Code:
IN564565423413
B M M LM786788
786HHHHJH

Here I am looking for a word "IN" in the input file and then I want to split the file on that perticular word.

Please help.

Thanks,
Sujit

Edited: Please use BBcode when You post some code/error, that's rather readable, Thanks... Anuj
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Wed Apr 01, 2009 9:21 pm    Post subject:
Reply with quote

You can use a DFSORT job like the following to do what you asked for. I assumed your input file has RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes.

Code:

//S1    EXEC  PGM=SORT                                             
//SYSOUT    DD  SYSOUT=*                                           
//SORTIN DD *                                                       
IN1234ABC                                                           
455656SDASDF                                                       
77789J JJJJKLL                                                     
IN564565423413                                                     
B M M LM786788                                                     
786HHHHJH                                                           
/*
//OUT1 DD SYSOUT=*                                                 
//OUT2 DD SYSOUT=*                                                 
//SYSIN    DD    *                                                 
  OPTION COPY                                                       
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,2,CH,EQ,C'IN'),                 
    PUSH=(81:ID=1))                                                 
  OUTFIL FNAMES=OUT1,INCLUDE=(81,1,CH,EQ,C'1'),BUILD=(1,80)         
  OUTFIL FNAMES=OUT2,SAVE,BUILD=(1,80)                             
/*
Back to top
View user's profile Send private message
Douglas Wilder

Active User


Joined: 28 Nov 2006
Posts: 305
Location: Deerfield IL

PostPosted: Thu Apr 02, 2009 1:33 am    Post subject:
Reply with quote

What release added Group and Push?
Code:
ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R5
            OPTION COPY                                     
            INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,2,CH,EQ,C'IN'),
                               $                             
ICE007A 0 SYNTAX ERROR                                       
              PUSH=(81:ID=1))                               
              $                                             
Back to top
View user's profile Send private message
Douglas Wilder

Active User


Joined: 28 Nov 2006
Posts: 305
Location: Deerfield IL

PostPosted: Thu Apr 02, 2009 1:43 am    Post subject:
Reply with quote

Never mind. You already posted this.
Code:
ICE201I E RECORD TYPE IS F - DATA STARTS IN POSITION 1
I need to wait for " F " not " E "
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Thu Apr 02, 2009 1:46 am    Post subject:
Reply with quote

You need z/OS DFSORT V1R5 PTF UK90013 (July, 2008). Ask your System Programmer to install it.
Back to top
View user's profile Send private message
chavansu

New User


Joined: 20 Nov 2008
Posts: 14
Location: California USA

PostPosted: Mon Apr 06, 2009 3:33 pm    Post subject:
Reply with quote

Hi Frank,

I am getting following syntax error.

Code:
1ICE143I 0 BLOCKSET     COPY  TECHNIQUE SELECTED                               
 ICE250I 0 VISIT http://www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES A
 ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R5 - 02:49 ON MON AP
0            OPTION COPY                                                       
             INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,2,CH,EQ,C'IN'),                 
               PUSH=(81:ID=1))                                                 
             OUTFIL FNAMES=OUT1,INCLUDE=(81,1,CH,EQ,C'1'),BUILD=(1,80)         
               OUTFIL FNAMES=OUT2,SAVE,BUILD=(1,80)                             
             /*                                                                 
             $                                                                 
 ICE007A 1 SYNTAX ERROR                                                         
 ICE751I 0 C5-K90013 C6-K90013 C7-K90000 C8-K90013 E7-K24705                   
 ICE052I 3 END OF DFSORT                                                       


not sure if this is related to version. Also I have one more doubt,
in the sorting parameter, you have mentioned "INCLUDE=(81,1,CH,EQ,C'1')" but I am not sure what will be the character after "IN"
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Mon Apr 06, 2009 9:18 pm    Post subject:
Reply with quote

Quote:
I am getting following syntax error.


The only way you could get that syntax error would be to have /* in positions 2-3 instead of in positions 1-2. The / must be in position 1.

Quote:
you have mentioned "INCLUDE=(81,1,CH,EQ,C'1')" but I am not sure what will be the character after "IN"


The '1' in the INCLUDE operand is for group 1 - it has nothing to do with the character after 'IN'.

For complete details on DFSORT's WHEN=GROUP function and the other new functions available with PTF UK90013, see:

www.ibm.com/systems/support/storage/software/sort/mvs/ugpf/
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Apr 07, 2009 12:22 am    Post subject:
Reply with quote

Douglas Wilder wrote:
Never mind. You already posted this.
Code:
ICE201I E RECORD TYPE IS F - DATA STARTS IN POSITION 1
I need to wait for " F " not " E "


You can achieve the results with the following JCL

Code:

//S1       EXEC  PGM=SORT         
//SYSOUT   DD  SYSOUT=*           
//SORTIN   DD *                   
IN1234ABC                         
455656SDASDF                     
77789J JJJJKLL                   
IN564565423413                   
B M M LM786788                   
786HHHHJH                         
/*                               
//OUT1     DD SYSOUT=*
//OUT2     DD SYSOUT=*
//SYSIN    DD *                                           
  OPTION COPY                                             
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD)),       
  IFTHEN=(WHEN=(1,2,CH,EQ,C'IN'),OVERLAY=(81:SEQNUM,8,ZD)),
  IFTHEN=(WHEN=NONE,OVERLAY=(89:SEQNUM,8,ZD,               
          81:81,8,ZD,SUB,89,8,ZD,TO=ZD,LENGTH=8))         

  OUTFIL FNAMES=OUT1,INCLUDE=(81,8,ZD,EQ,1),BUILD=(1,80)   
  OUTFIL FNAMES=OUT2,SAVE,BUILD=(1,80)                     
/*
Back to top
View user's profile Send private message
Douglas Wilder

Active User


Joined: 28 Nov 2006
Posts: 305
Location: Deerfield IL

PostPosted: Tue Apr 07, 2009 12:39 am    Post subject:
Reply with quote

Thank You S Kolusu.
Back to top
View user's profile Send private message
chavansu

New User


Joined: 20 Nov 2008
Posts: 14
Location: California USA

PostPosted: Tue Apr 07, 2009 12:38 pm    Post subject:
Reply with quote

Thanks a lot Frank. It worked !
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Changing of LRECL of a file abdulrafi DFSORT/ICETOOL 2 Fri Mar 24, 2017 3:25 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 4 Fri Mar 24, 2017 11:51 am
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Formatting VB File Learncoholic DFSORT/ICETOOL 3 Mon Mar 20, 2017 12:29 pm


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