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
 

 

spliting files from one input using Syncsort

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
abin

Active User


Joined: 14 Aug 2006
Posts: 198

PostPosted: Thu Jan 05, 2012 4:14 am    Post subject: spliting files from one input using Syncsort
Reply with quote

Hi,

I have following input

Code:
SENDSITE                                                   
LOCSI SBD=PPPP.INTRCONN.TCPIPBIN                           
CWD /HISHSS/PROD/ROW/SOURCE   
BINARY                                                     
PUT 'XXXX.YYYY.ZZZZZZZZ.AAAA.WWW(0)' +                     
     WWW_EEE_CCC_AAAA_20120104025016.dat.gz               
ASCII                                                     
PUT 'XXXX.YYYY.ZZZZZZZZ.AAAA.NNN(0)' +                     
     WWW_EEE_NNN_AAAA_20120104025016.trl                   
BINARY                                                     
PUT 'XXXX.YYYY.ZZZZZZZZ.BBBB.WWW(0)' +                     
     WWW_EEE_CCC_BBBB_20120104025016.dat.gz
ASCII                                                     
PUT 'XXXX.YYYY.ZZZZZZZZ.BBBB.NNN(0)' +                     
     WWW_EEE_NNN_BBBB_20120104025016.dat.gz
CLOSE                                                     
QUIT

I need to get the output in two files as follows.
output file 1:
Code:
SENDSITE                                                   
LOCSI SBD=PPPP.INTRCONN.TCPIPBIN                           
CWD /HISHSS/PROD/ROW/SOURCE   
BINARY                                                     
PUT 'XXXX.YYYY.ZZZZZZZZ.AAAA.WWW(0)' +                     
     WWW_EEE_CCC_AAAA_20120104025016.dat.gz               
ASCII                                                     
PUT 'XXXX.YYYY.ZZZZZZZZ.AAAA.NNN(0)' +                     
     WWW_EEE_NNN_AAAA_20120104025016.trl
CLOSE                                                     
QUIT 


Output file 2:
Code:
SENDSITE                                                   
LOCSI SBD=PPPP.INTRCONN.TCPIPBIN                           
CWD /HISHSS/PROD/ROW/SOURCE 
PUT 'XXXX.YYYY.ZZZZZZZZ.BBBB.WWW(0)' +                     
     WWW_EEE_CCC_BBBB_20120104025016.dat.gz
ASCII                                                     
PUT 'XXXX.YYYY.ZZZZZZZZ.BBBB.NNN(0)' +                     
     WWW_EEE_NNN_BBBB_20120104025016.dat.gz
CLOSE                                                     
QUIT


Does any one know if there is a method to achieve this using SYNCSORT.
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7241

PostPosted: Thu Jan 05, 2012 5:04 am    Post subject: Re: spliting files from one input using Syncsort
Reply with quote

abin wrote:
[...]
Does any one know if there is a method to achieve this using SYNCSORT.


Probably somebody knows.

Why do you want to split them? If they are created programatically, why can't they be written seperately/consecutively there? Or why not just create the dataset references and wrap the other stuff around? If they are manually created, why not just do a split? The more you can explain, the better the solutions you may receive.

Off-topic but, if you transfer a .gz doing EBCDIC-to-ASCII conversion, as you are with the fourth dataset, you're going to pickle it.
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Thu Jan 05, 2012 5:49 am    Post subject: Reply to: spliting files from one input using Syncsort
Reply with quote

Seems like there are a few options:

- you could just sequentially number the input records, then create each output dataset by including those particular record count numbers.

- seems like a good place to use an IFTHEN=(WHEN=GROUP construct, where you could create groups based on the occurence of the SENDSITE command, the next group on the occurence of each BINARY command, and the last on the CLOSE command. Then, include the relevant group id's for the output.
Back to top
View user's profile Send private message
xknight

Active User


Joined: 22 Jan 2008
Posts: 117
Location: Liberty city

PostPosted: Thu Jan 05, 2012 2:55 pm    Post subject:
Reply with quote

Hello,

Assuming 'NNN' would be constantly present in your file, used for the positioning. If its other than 'NNN' then change it accordingly.

Try the below code,

Code:
//STEP1 EXEC PGM=SORT                                                 
//SYSOUT DD SYSOUT=*                                                   
//SORTIN DD *                                                         
SENDSITE                                                               
LOCSI SBD=PPPP.INTRCONN.TCPIPBIN                                       
CWD /HISHSS/PROD/ROW/SOURCE                                           
BINARY                                                                 
PUT 'XXXX.YYYY.ZZZZZZZZ.AAAA.WWW(0)' +                                 
     WWW_EEE_CCC_AAAA_20120104025016.DAT.GZ                           
ASCII                                                                 
PUT 'XXXX.YYYY.ZZZZZZZZ.AAAA.NNN(0)' +                                 
     WWW_EEE_NNN_AAAA_20120104025016.TRL                               
BINARY                                                                 
PUT 'XXXX.YYYY.ZZZZZZZZ.BBBB.WWW(0)' +                                 
     WWW_EEE_CCC_BBBB_20120104025016.DAT.GZ                           
ASCII                                                                 
PUT 'XXXX.YYYY.ZZZZZZZZ.BBBB.NNN(0)' +                                 
     WWW_EEE_NNN_BBBB_20120104025016.DAT.GZ                     
CLOSE                                                           
QUIT                                                             
//OUT1    DD SYSOUT=*                                           
//OUT2    DD SYSOUT=*                                           
//SYSIN DD *                                                     
  SORT FIELDS=COPY                                               
  INREC IFTHEN=(WHEN=GROUP,                                     
                BEGIN=(1,5,CH,EQ,C'BINARY'),                     
                END=(14,3,CH,EQ,C'NNN'),                         
                PUSH=(90:ID=1))                                 
  OUTFIL OMIT=(90,1,CH,EQ,C'2'),FNAMES=OUT1                     
  OUTFIL OMIT=(90,1,CH,EQ,C'1'),FNAMES=OUT2                       


Output1

Code:
SENDSITE                                                       
LOCSI SBD=PPPP.INTRCONN.TCPIPBIN                               
CWD /HISHSS/PROD/ROW/SOURCE                                   
BINARY                                                         
PUT 'XXXX.YYYY.ZZZZZZZZ.AAAA.WWW(0)' +                         
     WWW_EEE_CCC_AAAA_20120104025016.DAT.GZ                   
ASCII                                                         
PUT 'XXXX.YYYY.ZZZZZZZZ.AAAA.NNN(0)' +                         
     WWW_EEE_NNN_AAAA_20120104025016.TRL                       
CLOSE                                                         
QUIT                   


Output 2

Code:
SENDSITE                                                     
LOCSI SBD=PPPP.INTRCONN.TCPIPBIN                             
CWD /HISHSS/PROD/ROW/SOURCE                                 
BINARY                                                       
PUT 'XXXX.YYYY.ZZZZZZZZ.BBBB.WWW(0)' +                       
     WWW_EEE_CCC_BBBB_20120104025016.DAT.GZ                 
ASCII                                                       
PUT 'XXXX.YYYY.ZZZZZZZZ.BBBB.NNN(0)' +                       
     WWW_EEE_NNN_BBBB_20120104025016.DAT.GZ                 
CLOSE                                                       
QUIT             
Back to top
View user's profile Send private message
abin

Active User


Joined: 14 Aug 2006
Posts: 198

PostPosted: Fri Jan 06, 2012 1:22 am    Post subject:
Reply with quote

Hi Bill,
Quote:
Off-topic but, if you transfer a .gz doing EBCDIC-to-ASCII conversion, as you are with the fourth dataset, you're going to pickle it.

It was a typo from my end, fourth data set is actually not a zip file.

Option Kevin and Xavier provided works perfectly. Now I need to play around a little, because that datetime stamp on my file "WWW_EEE_NNN_BBBB_20120104025016.DAT.GZ" is not a static value. Instead, I need to change it with current date time stamp.
for example my input will have "WWW_EEE_NNN_BBBB_YYYYMMDDHHMMSS.DAT.GZ" and o/p should be "WWW_EEE_NNN_BBBB_20120104025016.DAT.GZ",given 20120104025016 is the current date time stamp.

I know this option will help me to get the required result.
Code:
OUTREC IFTHEN=(WHEN=(1,5,CH,EQ,C'     '),           
              BUILD=(1,22,&DATE1,&TIME1,37,7,80:X))

But I am facing some problem when I mix it with the INREC. MMy o/p comes like below.
Code:
SENDSITE                                                       
LOCSI SBD=PPPP.INTRCONN.TCPIPBIN                               
CWD /HISHSS/PROD/ROW/SOURCE                                   
BINARY                                                         
PUT 'XXXX.YYYY.ZZZZZZZZ.AAAA.WWW(0)' +                         
     WWW_EEE_CCC_AAAA_20120104025016.DAT.GZ                   
ASCII                                                         
PUT 'XXXX.YYYY.ZZZZZZZZ.AAAA.NNN(0)' +                         
     WWW_EEE_NNN_AAAA_20120104025016.TRL 
     WWW_EEE_CCC_BBBB_20120104025016.DAT.GZ   
     WWW_EEE_NNN_BBBB_20120104025016.DAT.GZ                     
CLOSE                                                         
QUIT 


Can some one tell me where I can find more reading on the IFTHEN and WHEN option.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Jan 06, 2012 1:51 am    Post subject:
Reply with quote

Hello,

In the product documentation. If your organization is licensed to use the product, the material is available free from Syncsort Support.
Back to top
View user's profile Send private message
abin

Active User


Joined: 14 Aug 2006
Posts: 198

PostPosted: Fri Jan 06, 2012 3:54 am    Post subject:
Reply with quote

I found a work around. Now my code looks like this.

Code:

  SORT   FIELDS=COPY                                           
  INREC  IFTHEN=(WHEN=GROUP,                                   
                BEGIN=(1,5,CH,EQ,C'BINARY'),                   
                END=(14,3,CH,EQ,C'NNN'),                       
                PUSH=(90:ID=1))                                 
  OUTREC FIELDS=(1:1,22,                                       
                 23:23,8,                                       
                        CHANGE=(8,C'yyyymmdd',&DATE1),         
                        NOMATCH=(23,8),                         
                 31:31,60)                                     
  OUTFIL FNAMES=FTPCNTLP,OMIT=(90,1,CH,EQ,C'2')                 
  OUTFIL FNAMES=FTPCNTLS,OMIT=(90,1,CH,EQ,C'1')                 


but SYNCSORT is ot allowig me to replace yyyymmdd with &DATE1.
When I do it, I get following error.
Code:
OUTREC FIELDS=(1:1,22,                                     
                 23:23,8,                                   
                        CHANGE=(8,C'yyyymmdd',&DATE1),       
                        *                                   
                        NOMATCH=(23,8),                     
                 31:31,60)                                   
  OUTFIL FNAMES=FTPCNTLP,OMIT=(90,1,CH,EQ,C'2')             
  OUTFIL FNAMES=FTPCNTLS,OMIT=(90,1,CH,EQ,C'1')             
WER268A  OUTREC STATEMENT  : SYNTAX ERROR                   
WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000               
WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE               

From product documentation it says replacemnet string should be a character, &DATE1 as per documentation is character C'yyyymmdd'.

Any idea why change is not accepting &DATE1.
Back to top
View user's profile Send private message
abin

Active User


Joined: 14 Aug 2006
Posts: 198

PostPosted: Fri Jan 06, 2012 4:28 am    Post subject:
Reply with quote

Hi Dick,

Looks like my site documentation is not updated with latest syncsort doc. Can you tell me how PUSH works in this specific scenarion.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7241

PostPosted: Fri Jan 06, 2012 4:37 am    Post subject: Reply to: spliting files from one input using Syncsort
Reply with quote

You can see how the following goes in place of your OUTREC. It identifies the data to be changed by the five blanks at the start of the line. Doesn't bother actually changing anything, just drops in the date and time.

Code:
OUTREC IFTHEN=(WHEN=(1,5,CH,EQ,C' '),
                                   BUILD=(1:1,22,23:&DATE1,&TIME1,37,60))
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Jan 06, 2012 8:56 am    Post subject:
Reply with quote

Hello,

Quote:
Looks like my site documentation is not updated with latest syncsort doc.
Then you (or someone in your local system support group) needs to ask Syncsort Support for the documentation that is for your release of the product. . .

How did the question move from CHANGE to PUSH?

Is there a new issue? Has the actual requirement been described or are we shooting at a moving target?
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Fri Jan 06, 2012 2:24 pm    Post subject:
Reply with quote

Hi,

I think the OP was trying to create the output file as 80 bytes, so adding on from what Bill suggested, he should try this
Code:
  OUTREC IFTHEN=(WHEN=(1,5,CH,EQ,C' '),                 
                BUILD=(1,22,&DATE1,&TIME1,37,54))       
  OUTFIL OMIT=(90,1,CH,EQ,C'2'),FNAMES=OUT1,BUILD=(1,80)
  OUTFIL OMIT=(90,1,CH,EQ,C'1'),FNAMES=OUT2,BUILD=(1,80)



Gerry
Back to top
View user's profile Send private message
abin

Active User


Joined: 14 Aug 2006
Posts: 198

PostPosted: Sat Jan 07, 2012 5:02 am    Post subject:
Reply with quote

Hi Dick,

Quote:
How did the question move from CHANGE to PUSH?
Intiall requirement was satisfied. I added a new requirement to get current date time and I was trying to get this done by CHANGE sub parameter in OUTREC.

Hi Gerry and Bill,

Code
Code:
OUTREC IFTHEN=(WHEN=(1,5,CH,EQ,C' '),           
                BUILD=(1,22,&DATE1,&TIME1,37,54))

works perfectly fo my requirement. My bad I didnt noticed OUTREC processing happens before OMIT processing.

Thanks a lot for your help all, that was really an eye opener for me.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Sat Jan 07, 2012 11:40 am    Post subject:
Reply with quote

Hi,

to be precise, OUTREC processing occurs before OUTFIL processing.


Gerry
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Sat Jan 07, 2012 1:34 pm    Post subject: Reply to: spliting files from one input using Syncsort
Reply with quote

Good to hear it is working - thank you for letting us know icon_smile.gif

d
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 Performing arithmetic on input field zh_lad DFSORT/ICETOOL 24 Tue Dec 06, 2016 8:04 pm
No new posts syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 8 Thu Dec 01, 2016 8:28 pm
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
No new posts Syncsort - Hard coded Value in output PORYES SYNCSORT 1 Thu Nov 03, 2016 9:23 am


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