Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 10310
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: 2285
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
No new posts Split 1 file into 10 output Files - S... Prasanth Kumar SYNCSORT 5 Sat Sep 16, 2017 12:02 am
No new posts BUILD OUTFIL based on condition other... balaji81_k DFSORT/ICETOOL 13 Fri Sep 08, 2017 11:06 pm
No new posts Skip file from delete pema_yozer All Other Mainframe Topics 3 Tue Aug 29, 2017 3:19 pm
No new posts editting the file by inserting zeros ... pramodrsingh DFSORT/ICETOOL 9 Mon Aug 21, 2017 5:58 pm
No new posts Match two files using multiple keys a... santoshks1987 SYNCSORT 11 Fri Aug 18, 2017 10:50 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us