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
 

 

JCl required for file splitting

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: JCl required for file splitting
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10274
Location: italy

PostPosted: Tue Sep 01, 2009 11:44 am    Post subject: Reply to: JCl required for file splitting
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    Post subject:
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    Post subject:
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: 2284
Location: @my desk

PostPosted: Tue Sep 01, 2009 4:12 pm    Post subject:
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    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
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts How to generate a new unique Input fi... for1ranjith CLIST & REXX 11 Sat Jul 01, 2017 12:09 pm
No new posts Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm


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