How to split the file based on some symbols?



Support for NetApp SyncSort for z/OS, Visual SyncSort, SYNCINIT, SYNCLIST and SYNCTOOL

How to split the file based on some symbols?

Postby pjagathis » Mon Jan 09, 2012 2:44 pm

Hi all,

I have to split the input file in two files..

Input file is having symbol "+" any where in the record of lrecl=100.

some records won't have that symbol "+" in it.

Output file - 01 => Records with symbol "+".
Output file - 02 => Records without symbol "+".


Please help me...!
Thanks and Regards,
Jagathis P
pjagathis
 
Posts: 67
Joined: Wed May 04, 2011 5:04 pm
Location: Chennai
Has thanked: 0 time
Been thanked: 0 time

Re: How to split the file based on some symbols?

 

Re: How to split the file based on some symbols?

Postby dick scherrer » Mon Jan 09, 2012 10:33 pm

Hello,

You might consider SubString (SS):
INCLUDE COND=(1,yourlrecl,SS,EQ,C'+')
for one file and
INCLUDE COND=(1,yourlrecl,SS,NE,C'+')
for the other.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: How to split the file based on some symbols?

Postby BillyBoyo » Tue Jan 10, 2012 12:57 am

You should be able to do this in one step, using two OUTFIL statements, one with each of the INCLUDEs that Dick has suggested.

If you search here, you should find some examples. Let us know how it goes.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: How to split the file based on some symbols?

Postby pjagathis » Tue Jan 10, 2012 6:15 pm

Hi dick scherrer/BillyBoyo,

Thanks for your help...

Code works..!. Obtained the expected result...!

One more help..,

Can we split the file based on number of occurence of symbol ?

Output file1:
Record with ZERO "+" symbol

Output file 2:
Record with one "+" symbol

Output file3:
Record with two "+" symbol
Thanks and Regards,
Jagathis P
pjagathis
 
Posts: 67
Joined: Wed May 04, 2011 5:04 pm
Location: Chennai
Has thanked: 0 time
Been thanked: 0 time

Re: How to split the file based on some symbols?

Postby dick scherrer » Wed Jan 11, 2012 6:28 am

Hello,

Think about your Total requirement.

It is a complete waste of time for people to have to deal with things as you choose to post them.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: How to split the file based on some symbols?

Postby BillyBoyo » Sat Jan 14, 2012 5:55 am

This runs with DFSORT and works with that product.

If you want to know what it is doing, look at the second step, which is the same thing but coded with DFSORT symbols.

//SPLITPL EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SYSIN DD *
                                                   
 OPTION COPY
                                                   
 INREC IFTHEN=(WHEN=INIT,
   PARSE=(%01=(STARTAT=C'+',FIXLEN=1),
          %02=(STARTAT=C'+',FIXLEN=1)),
   OVERLAY=(81:%01,%02))
                                                   
 OUTFIL FILES=01,INCLUDE=(81,2,CH,EQ,C'  '),
         BUILD=(1,80)
 OUTFIL FILES=02,INCLUDE=(81,2,CH,EQ,C'+ '),
         BUILD=(1,80)
 OUTFIL FILES=03,INCLUDE=(81,2,CH,EQ,C'++'),
         BUILD=(1,80)
/*
//SORTOF01 DD SYSOUT=*
//SORTOF02 DD SYSOUT=*
//SORTOF03 DD SYSOUT=*
//SORTIN DD *
++++
+++
++
+
-


//SPLITPLS EXEC PGM=SORT                                     
//SYSOUT   DD SYSOUT=*
//SYMNOUT  DD SYSOUT=*
//SYMNAMES DD *
INPUT-RECORD,1,80
FIRST-BYTE-AFTER-INPUT-RECORD,*,1,CH
EXTENDED-TEST-FOR-PLUS,=,2,CH
FIRST-PLUS-IF-PRESENT-ELSE-BLANK,%01
SECOND-PLUS-IF-PRESENT-ELSE-BLANK,%02
NO-PLUSSES,C'  '
ONE-PLUS,C'+ '
TWO-OR-MORE-PLUSSES,C'++'
//SYSIN DD *
                                                                     
 OPTION COPY
                                                                     
 INREC IFTHEN=(WHEN=INIT,
   PARSE=(FIRST-PLUS-IF-PRESENT-ELSE-BLANK=(STARTAT=C'+',FIXLEN=1),
          SECOND-PLUS-IF-PRESENT-ELSE-BLANK=(STARTAT=C'+',FIXLEN=1)),
   OVERLAY=(FIRST-BYTE-AFTER-INPUT-RECORD:
             FIRST-PLUS-IF-PRESENT-ELSE-BLANK,
             SECOND-PLUS-IF-PRESENT-ELSE-BLANK))
                                                                     
 OUTFIL FILES=01,INCLUDE=(EXTENDED-TEST-FOR-PLUS,
                          EQ,NO-PLUSSES),
         BUILD=(INPUT-RECORD)
 OUTFIL FILES=02,INCLUDE=(EXTENDED-TEST-FOR-PLUS,
                          EQ,ONE-PLUS),
         BUILD=(INPUT-RECORD)
 OUTFIL FILES=03,INCLUDE=(EXTENDED-TEST-FOR-PLUS,
                          EQ,TWO-OR-MORE-PLUSSES),
         BUILD=(INPUT-RECORD)
/*
//SORTOF01 DD SYSOUT=*
//SORTOF02 DD SYSOUT=*
//SORTOF03 DD SYSOUT=*
//SORTIN DD *
++++
+++
++
+
-
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: How to split the file based on some symbols?

Postby dick scherrer » Sat Jan 14, 2012 10:48 am

Hi Bill,

This runs with DFSORT and works with that product.

However, this topic is in the Syncsort part of the forum. Possibly incorrectly, but i just figured TS was using Syncsort. . . ;)
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: How to split the file based on some symbols?

Postby BillyBoyo » Sat Jan 14, 2012 9:03 pm

Hi Dick,

I checked that all the functions are available in Syncsort. I can't check the actual syntax of them. As far as I can see it "should" work, but that was my "get out" if it doesn't. If it gets any "syntax" errors, then it will be up to the TS to sit down with their Syncsort manual and do a bit of research/learning, before coming back with anything that is still a problem :-)

And to post the working solution for the benefit of future readers.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: How to split the file based on some symbols?

Postby dick scherrer » Sun Jan 15, 2012 11:50 am

Hi Bill,

Yup, hopefully, TS will let us know if all is well and share the final jcl/control statements.

Have a great rest of the wekend!

d
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times


Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post