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
 

 

count number of delimiters create seperate two files

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
pema_yozer

New User


Joined: 16 Feb 2009
Posts: 45
Location: pune

PostPosted: Wed May 05, 2010 3:54 pm    Post subject: count number of delimiters create seperate two files
Reply with quote

i am getting data file from source which is | delimited.
need to count the number of delimiters from each record and if delimiter's count is plus one from other record's count then create seperate file and put record (which has plus one delimiter) in separate file and rest of the records in other file. could any one please suggest how it can be done?
Back to top
View user's profile Send private message

Escapa

Senior Member


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

PostPosted: Wed May 05, 2010 5:11 pm    Post subject:
Reply with quote

Do you have constant count of the delimiter expected and if it is not then needs to be written in seperate output?
Back to top
View user's profile Send private message
pema_yozer

New User


Joined: 16 Feb 2009
Posts: 45
Location: pune

PostPosted: Wed May 05, 2010 5:16 pm    Post subject:
Reply with quote

yes that is correct
example every record shoudl only have 10 delimiter
if its 11 in any then it needs to be written in a seperteoutput file
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed May 05, 2010 9:45 pm    Post subject:
Reply with quote

pema_yozer,

use the following DFSORT JCL. I assumed the file to be FB recfm and 80 bytes length and the delimiter is semicolon. If your input has more than 10 delimiters it will be written to OUT2 and OUT1 file will have records with less than or equal to 10 delimiters

Code:

//STEP0100 EXEC PGM=SORT                         
//SYSOUT   DD SYSOUT=*                           
//SORTIN   DD *                                   
1B7HC16Y9X3333339,,,,,,,,,,,,,                   
2001,PONTIAC,FIREBIRD,,,,,,,,,                   
2G2GGIK81333666,,,,,,,,,,,,,,,                   
4Y756JUKOD6767666653666,,,,,,,                   
1990,BENZ,CORVETTE,,,,,,,,,,,,                   
1C7HBAS805L510444,,,,,,,,,,,,,                   
1975,INTERNATIONAL,MODEL,1111,                   
8VRTT,43333666789,,,,,,,,,,,,,                   
//OUT1     DD SYSOUT=*                           
//OUT2     DD SYSOUT=*                           
//SYSIN    DD *                                   
  SORT FIELDS=COPY                               
  INREC PARSE=(%=(STARTAT=C','),                 
               %=(STARTAT=C','),                 
               %=(STARTAT=C','),                 
               %=(STARTAT=C','),                 
               %=(STARTAT=C','),                 
               %=(STARTAT=C','),                 
               %=(STARTAT=C','),                 
               %=(STARTAT=C','),                 
               %=(STARTAT=C','),                 
               %=(STARTAT=C','),                 
               %1=(STARTAT=C',',FIXLEN=1)),       
        OVERLAY=(81:%1)                           
  OUTFIL FNAMES=OUT1,INCLUDE=(81,1,CH,EQ,C' '),BUILD=(1,80)   
  OUTFIL FNAMES=OUT2,SAVE,BUILD=(1,80)                       
//*
Back to top
View user's profile Send private message
pema_yozer

New User


Joined: 16 Feb 2009
Posts: 45
Location: pune

PostPosted: Thu May 06, 2010 9:26 am    Post subject:
Reply with quote

if data file is not FB i.e if it is variable length then also your suggetsed solution will work or not?
Back to top
View user's profile Send private message
Escapa

Senior Member


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

PostPosted: Thu May 06, 2010 10:06 am    Post subject:
Reply with quote

pema_yozer wrote:
if data file is not FB i.e if it is variable length then also your suggetsed solution will work or not?

No It might not.

Thats why, you need to tell your ALL requirements very clearly.


Now again,
if file is VB what is LRECL?
Back to top
View user's profile Send private message
pema_yozer

New User


Joined: 16 Feb 2009
Posts: 45
Location: pune

PostPosted: Thu May 06, 2010 10:17 am    Post subject:
Reply with quote

LRECL=436
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu May 06, 2010 10:20 pm    Post subject:
Reply with quote

pema_yozer,

You could have saved a lot of your time as well as other people's time if you had specified your requirements clearly in the first post itself. Even now there is a guess work as to what the delimiter is.

try this DFSORT JCL

Code:

//STEP0200 EXEC PGM=SORT                                     
//SYSOUT   DD SYSOUT=*                                       
//SORTIN   DD DSN=your input VB 436 file,DISP=SHR
//OUT1     DD SYSOUT=*                                       
//OUT2     DD SYSOUT=*                                       
//SYSIN    DD *                                             
  SORT FIELDS=COPY                                           
  INREC PARSE=(%=(STARTAT=C','),                             
               %=(STARTAT=C','),                             
               %=(STARTAT=C','),                             
               %=(STARTAT=C','),                             
               %=(STARTAT=C','),                             
               %=(STARTAT=C','),                             
               %=(STARTAT=C','),                             
               %=(STARTAT=C','),                             
               %=(STARTAT=C','),                             
               %=(STARTAT=C','),                             
               %1=(STARTAT=C',',FIXLEN=1)),                 
        BUILD=(1,4,%1,5)                                     
                                                             
  OUTFIL FNAMES=OUT1,INCLUDE=(5,1,CH,EQ,C' '),BUILD=(1,4,6) 
  OUTFIL FNAMES=OUT2,SAVE,BUILD=(1,4,6)                     
//*
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Using ICETOOL, how we can seperate th... bshkris SYNCSORT 5 Tue May 09, 2017 8:33 pm
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts Unable to create multiple files using... mbattu COBOL Programming 3 Fri May 05, 2017 5:35 pm
No new posts SMTP the current generation number of... Jyothi Kulunde JCL & VSAM 4 Thu May 04, 2017 4:08 pm
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm


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