View previous topic :: View next topic
Author
Message
chavansu New User Joined: 20 Nov 2008Posts: 14 Location: California USA
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
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
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
Douglas Wilder Active User Joined: 28 Nov 2006Posts: 305 Location: Deerfield IL
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
Douglas Wilder Active User Joined: 28 Nov 2006Posts: 305 Location: Deerfield IL
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
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
You need z/OS DFSORT V1R5 PTF UK90013 (July, 2008). Ask your System Programmer to install it.
Back to top
chavansu New User Joined: 20 Nov 2008Posts: 14 Location: California USA
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
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
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
Skolusu Senior Member Joined: 07 Dec 2007Posts: 2205 Location: San Jose
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
Douglas Wilder Active User Joined: 28 Nov 2006Posts: 305 Location: Deerfield IL
Thank You S Kolusu.
Back to top
chavansu New User Joined: 20 Nov 2008Posts: 14 Location: California USA
Thanks a lot Frank. It worked !
Back to top
Please enable JavaScript!