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

Split the input file between 2 specific words


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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 Developer


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

PostPosted: Wed Apr 01, 2009 9:21 pm
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
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
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 Developer


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

PostPosted: Thu Apr 02, 2009 1:46 am
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
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 Developer


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

PostPosted: Mon Apr 06, 2009 9:18 pm
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:

Use [URL] BBCode for External Links
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
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 2
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top