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

JCl required for file splitting


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
bnsahoo

New User


Joined: 06 Jun 2005
Posts: 18
Location: mumbai,india

PostPosted: Thu Aug 27, 2009 11:16 am
Reply with quote

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
View user's profile Send private message
Ketan Varhade

Active User


Joined: 29 Jun 2009
Posts: 197
Location: Mumbai

PostPosted: Thu Aug 27, 2009 11:20 am
Reply with quote

Hi,
How many such end can come in the file ?
Back to top
View user's profile Send private message
bnsahoo

New User


Joined: 06 Jun 2005
Posts: 18
Location: mumbai,india

PostPosted: Thu Aug 27, 2009 11:30 am
Reply with quote

There is only 1 'end' in the file.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Aug 27, 2009 12:00 pm
Reply with quote

This is very easy if you have DFSORT at your shop.

Is this is the you are using at your shop?
Back to top
View user's profile Send private message
bnsahoo

New User


Joined: 06 Jun 2005
Posts: 18
Location: mumbai,india

PostPosted: Thu Aug 27, 2009 12:13 pm
Reply with quote

yes.we have DFSORT.Can you please let me know the SYSIN card to do it.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Aug 27, 2009 12:55 pm
Reply with quote

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
View user's profile Send private message
bnsahoo

New User


Joined: 06 Jun 2005
Posts: 18
Location: mumbai,india

PostPosted: Tue Sep 01, 2009 11:33 am
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Tue Sep 01, 2009 11:44 am
Reply with quote

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 icon_evil.gif
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue Sep 01, 2009 11:46 am
Reply with quote

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
View user's profile Send private message
bnsahoo

New User


Joined: 06 Jun 2005
Posts: 18
Location: mumbai,india

PostPosted: Tue Sep 01, 2009 12:25 pm
Reply with quote

Apologies..Can anybody provide solution using SYNCSORT?
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Tue Sep 01, 2009 4:12 pm
Reply with quote

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
Code:
aaa
bbb
ccc
dddd
OUT2
Code:
fffffff   
ggggg     
hhhhh     
iiiiiiiiiii
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 How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts Need help for File Aid JCL to extract... Compuware & Other Tools 23
Search our Forums:

Back to Top