View previous topic :: View next topic
Author
Message
bnsahoo New User Joined: 06 Jun 2005Posts: 18 Location: mumbai,india
Hi,
I have a input file in following stracture
aaa
bbb
ccc
dddd
end
fffffff
ggggg
hhhhh
iiiiiiiiiii
I want to get the output in 2 separate as follows
1st output file
aaa
bbb
ccc
dddd
2nd output file
fffffff
ggggg
hhhhh
iiiiiiiiiii
Is there any JCL utility can splitt the file when literral 'end' is encountered at any record in the file?i.e from start of the file to literal 'end' found of any record in one file and immediate records after literal 'end' found of any record till end of file to another file.
Thanks in advance.
bnsahoo
Back to top
Ketan Varhade Active User Joined: 29 Jun 2009Posts: 197 Location: Mumbai
Hi,
How many such end can come in the file ?
Back to top
bnsahoo New User Joined: 06 Jun 2005Posts: 18 Location: mumbai,india
There is only 1 'end' in the file.
Back to top
Escapa Senior Member Joined: 16 Feb 2007Posts: 1399 Location: IL, USA
This is very easy if you have DFSORT at your shop.
Is this is the you are using at your shop?
Back to top
bnsahoo New User Joined: 06 Jun 2005Posts: 18 Location: mumbai,india
yes.we have DFSORT.Can you please let me know the SYSIN card to do it.
Back to top
Escapa Senior Member Joined: 16 Feb 2007Posts: 1399 Location: IL, USA
Hi Bnsahoo,
Use below step to get desired output.
Code:
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTMSG DD SYSOUT=*
//SORTIN DD *
aaa
bbb
ccc
dddd
end
fffffff
ggggg
hhhhh
iiiiiiiiiii
/*
//SYSOUT DD SYSOUT=*
//OUT1 DD SYSOUT=*
//OUT2 DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'end'),
PUSH=(81:ID=1))
OUTFIL FNAMES=OUT1,INCLUDE=(81,1,ZD,NE,1),BUILD=(1,80)
OUTFIL FNAMES=OUT2,INCLUDE=(81,1,ZD,EQ,1,AND,1,3,CH,NE,C'end'),
BUILD=(1,80)
/*
Back to top
bnsahoo New User Joined: 06 Jun 2005Posts: 18 Location: mumbai,india
The Above code is throwing following error
SYSIN :
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,BEGIN=(2,5,CH,EQ,C'START'),
*
END=(2,3,CH,EQ,C'END'),PUSH=(81:ID=1))
OUTFIL FNAMES=OUT1,INCLUDE=(81,1,ZD,NE,1),BUILD=(1,80)
OUTFIL FNAMES=OUT2,INCLUDE=(81,1,ZD,EQ,1,AND,1,5,CH,NE,C'*END*'),
BUILD=(1,80)
WER268A INREC STATEMENT : SYNTAX ERROR
Back to top
enrico-sorichetti Superior Member Joined: 14 Mar 2007Posts: 10872 Location: italy
Quote:
yes.we have DFSORT.Can you please let me know the SYSIN card to do it.
No, You do not
the WER.... messages indicate that Your shop is using SYNCSORT
posting erroneous information just makes everybody lose time
Back to top
Escapa Senior Member Joined: 16 Feb 2007Posts: 1399 Location: IL, USA
Quote:
Moved: Thu Aug 27, 2009 9:57 pm by Frank Yaeger From JCL to DFSORT/ICETOOL
Looks like again time to move this back to JCL forum.
Quote:
WER268A INREC STATEMENT : SYNTAX ERROR
OP is not using DFSORT but SYNCSORT..
Back to top
bnsahoo New User Joined: 06 Jun 2005Posts: 18 Location: mumbai,india
Apologies..Can anybody provide solution using SYNCSORT?
Back to top
Arun Raj Moderator Joined: 17 Oct 2006Posts: 2481 Location: @my desk
bnsahoo,
The below SyncSort job does what you asked.
Code:
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
aaa
bbb
ccc
dddd
end
fffffff
ggggg
hhhhh
iiiiiiiiiii
//S1 DD DSN=&&S1,DISP=(,PASS),UNIT=SYSDA
//T1 DD DSN=&&T1,DISP=(,PASS),UNIT=SYSDA
//SYSIN DD *
INREC OVERLAY=(81:SEQNUM,8,ZD)
SORT FIELDS=COPY
OUTFIL FNAMES=T1
OUTFIL FNAMES=S1,
INCLUDE=(1,3,CH,EQ,C'end'),BUILD=(C'END,+',81,8,80:X)
//STEP0200 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=&&T1,DISP=(OLD,PASS)
//OUT1 DD SYSOUT=*
//OUT2 DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL FNAMES=OUT1,INCLUDE=(81,8,ZD,LT,END),BUILD=(1,80)
OUTFIL FNAMES=OUT2,INCLUDE=(81,8,ZD,GT,END),BUILD=(1,80)
OUT1
OUT2
Code:
fffffff
ggggg
hhhhh
iiiiiiiiiii
Back to top
Please enable JavaScript!