|
View previous topic :: View next topic
|
| Author |
Message |
abin
Active User
.jpg)
Joined: 14 Aug 2006 Posts: 198
|
|
|
|
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 |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
| 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 |
|
 |
superk
Global Moderator

Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
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 |
|
 |
xknight
Active User

Joined: 22 Jan 2008 Posts: 117 Location: Liberty city
|
|
|
|
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 |
|
 |
abin
Active User
.jpg)
Joined: 14 Aug 2006 Posts: 198
|
|
|
|
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 |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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 |
|
 |
abin
Active User
.jpg)
Joined: 14 Aug 2006 Posts: 198
|
|
|
|
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 |
|
 |
abin
Active User
.jpg)
Joined: 14 Aug 2006 Posts: 198
|
|
|
|
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 |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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 |
|
 |
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
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 |
|
 |
abin
Active User
.jpg)
Joined: 14 Aug 2006 Posts: 198
|
|
|
|
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 |
|
 |
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
to be precise, OUTREC processing occurs before OUTFIL processing.
Gerry |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Good to hear it is working - thank you for letting us know
d |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|