|
View previous topic :: View next topic
|
| Author |
Message |
ram_vizag
Active User
Joined: 21 Aug 2008 Posts: 112 Location: hyd
|
|
|
|
Hi,
I have a file of length 234. i need to sort it excluding header and trailer and by removing duplicated as well and record count should be there from 165-174. In the hedaer records from 107 to 116(current date will be there which changes from file to file)
input:
| Code: |
HDR 2011-10-31(crt dte)
CST
CST 111000000000001000000000000001
CST 111000000000003000000000000003
CST 000000000000003000000000000003
CST 001005120809758000005120809758
TLR |
out put : 6:3 is filed to be sorted.
| Code: |
HDR 2011-10-31
CST 000000000000001000000000000001
CST 001000000000003000000000000003
CST 111005120809758000005120809758
TLR 0000000003 |
IN HEADER THE DATE SHOULD BE THERE IN THE FILEDS FROM 107-116
AND TRAILER THE COUNT VALUE SHOULD BE THERE IN THE FIELD LENTH FROM 165-174.
THE FOLLWOING IS NOT WORKING FOR ME
| Code: |
SORT FIELDS=(06,03,CH,A)
SUM FIELDS=NONE
OUTFIL REMOVECC,
TRAILER1=(C'TLR',COUNT=(EDIT=(TT))) |
|
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
| Can you show in what way it was "not working", if you need some sort of useful answer. |
|
| Back to top |
|
 |
ram_vizag
Active User
Joined: 21 Aug 2008 Posts: 112 Location: hyd
|
|
|
|
| Bill Woodger wrote: |
| Can you show in what way it was "not working", if you need som sort of useful answer. |
the output for my above code is like this
| Code: |
HDR Date is being reomved(why???)
CST 000000000000001000000000000001
CST 001000000000003000000000000003
CST 111005120809758000005120809758
TLR03 record count should be at from lenth i specified above but coming immediatly why so??? |
but i want the hdr date and record cound in the mentioned fields. the date is not at all carried out in the output file generated by sort.
Please some one suggest. |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
You are telling the trailer count to appear at the next available position. To get it to the position you want, you have to tell it somehthing else. Do you really only want a two-byte count, or is this just an example?
Do you want the CST of 000 and 111 to be treated as duplicate, as in your example?
Edit: I'm getting very confused looking at your example. Can you please check your input file, sort cards, and output created. If you need to re-post, please use the Code tags. |
|
| Back to top |
|
 |
ram_vizag
Active User
Joined: 21 Aug 2008 Posts: 112 Location: hyd
|
|
|
|
| Bill Woodger wrote: |
You are telling the trailer count to appear at the next available position. To get it to the position you want, you have to tell it somehthing else. Do you really only want a two-byte count, or is this just an example?
Do you want the CST of 000 and 111 to be treated as duplicate, as in your example?
Edit: I'm getting very confused looking at your example. Can you please check your input file, sort cards, and output created. If you need to re-post, please use the Code tags. |
Hi Bill,
i have only two querries here.
1)In the header record what i need to do to carry the current date in the field from length 107 to 116 as well in the output sort file which is not cuurently working
2) in the trailer records the count should be in the position from 165-174.
ex: for count 15 its should be 0000000015.
3) I dont want cst of 000 and 111 are to be treated as duplicates.only 6:3 from the record should not be duplicates which i already take care of.
Remaining i'll take care.please help or do u need some more info.thanks and please help me in this regard.
Ram... |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
You don't have any codewhich would get you the current date. Do you have that on your existing input file, or is it something you want to add?
If the latter, what do you want for the source of the date? Hopefully some business date, not the system date? (One day I'll be surprised).
I have no idea how you get from your input sample (in your first post) to your output sample. Which is why I want you to confirm everything, so we don't go chasing off on the wrong track(s). |
|
| Back to top |
|
 |
ram_vizag
Active User
Joined: 21 Aug 2008 Posts: 112 Location: hyd
|
|
|
|
| Bill Woodger wrote: |
You don't have any codewhich would get you the current date. Do you have that on your existing input file, or is it something you want to add?
If the latter, what do you want for the source of the date? Hopefully some business date, not the system date? (One day I'll be surprised).
I have no idea how you get from your input sample (in your first post) to your output sample. Which is why I want you to confirm everything, so we don't go chasing off on the wrong track(s). |
bill,
the input sort file will have the current date. its been generated from oe program...after that i want to sort as i told in the above.removing the header and trailer reocrds i want to sort the records.the conditions u know i guess from post above.please suggest... |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Ram,
Please go back to my earlier questions. I can't see how your input gets to your output with your sort cards. If all that you have shown us is correct, then I am wrong. If not, then show all the correct stuff for some progress.
Until then I'm out of this one. |
|
| Back to top |
|
 |
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
ram_vizag,
Please post sample input using code tags.
1) What happened to 2nd record in your sample input with just CST? Is that a typo?
2) Last record is TLR. Did you mean TRL for trailer?
3) Why do you even mention Date? Do you need, date changed on HEADER record?
Regardless, see if below works. I am assuming input is 234/FB and for detail records (other HDR and TRL/TRL record),you want to remove duplicate based on field starting at 6th position for 3 bytes.
| Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
HDR 2011-10-31(CRT DTE)
CST
CST 111000000000001000000000000001
CST 111000000000003000000000000003
CST 000000000000003000000000000003
CST 999000000000003000000000000003
CST 001005120809758000005120809758
TLR
//SORTOUT DD SYSOUT=*
//SYSIN DD *
INREC IFTHEN=(WHEN=INIT,OVERLAY=(243:C'1',244:6,3)),
IFTHEN=(WHEN=GROUP,BEGIN=(01,03,CH,EQ,C'HDR'),
PUSH=(235:ID=8)),
IFTHEN=(WHEN=(01,03,CH,EQ,C'HDR'),OVERLAY=(243:C'0000')),
IFTHEN=(WHEN=(01,03,CH,EQ,C'TLR'),OVERLAY=(243:C'9999'))
SORT FIELDS=(235,8,ZD,A,243,4,CH,A),EQUALS
SUM FIELDS=NONE
OUTFIL IFTRAIL=(HD=YES,TRLID=(1,3,CH,EQ,C'TLR'),
TRLUPD=(165:COUNT=(M11,LENGTH=10))),BUILD=(1,234)
//*
|
| Code: |
HDR 2011-10-31(CRT DTE)
CST
CST 000000000000003000000000000003
CST 001005120809758000005120809758
CST 111000000000001000000000000001
CST 999000000000003000000000000003
TLR |
TLR record has 0000000005 starting at 165th position.
Thanks, |
|
| Back to top |
|
 |
ram_vizag
Active User
Joined: 21 Aug 2008 Posts: 112 Location: hyd
|
|
|
|
| sqlcode1 wrote: |
ram_vizag,
Please post sample input using code tags.
1) What happened to 2nd record in your sample input with just CST? Is that a typo?
2) Last record is TLR. Did you mean TRL for trailer?
3) Why do you even mention Date? Do you need, date changed on HEADER record?
Regardless, see if below works. I am assuming input is 234/FB and for detail records (other HDR and TRL/TRL record),you want to remove duplicate based on field starting at 6th position for 3 bytes.
| Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
HDR 2011-10-31(CRT DTE)
CST
CST 111000000000001000000000000001
CST 111000000000003000000000000003
CST 000000000000003000000000000003
CST 999000000000003000000000000003
CST 001005120809758000005120809758
TLR
//SORTOUT DD SYSOUT=*
//SYSIN DD *
INREC IFTHEN=(WHEN=INIT,OVERLAY=(243:C'1',244:6,3)),
IFTHEN=(WHEN=GROUP,BEGIN=(01,03,CH,EQ,C'HDR'),
PUSH=(235:ID=8)),
IFTHEN=(WHEN=(01,03,CH,EQ,C'HDR'),OVERLAY=(243:C'0000')),
IFTHEN=(WHEN=(01,03,CH,EQ,C'TLR'),OVERLAY=(243:C'9999'))
SORT FIELDS=(235,8,ZD,A,243,4,CH,A),EQUALS
SUM FIELDS=NONE
OUTFIL IFTRAIL=(HD=YES,TRLID=(1,3,CH,EQ,C'TLR'),
TRLUPD=(165:COUNT=(M11,LENGTH=10))),BUILD=(1,234)
//*
|
| Code: |
HDR 2011-10-31(CRT DTE)
CST
CST 000000000000003000000000000003
CST 001005120809758000005120809758
CST 111000000000001000000000000001
CST 999000000000003000000000000003
TLR |
TLR record has 0000000005 starting at 165th position.
Thanks, |
Thanks sqlcode1,
i want to sort from field 07 to 15 chars...(07:15) changed accordingly and got below syntax erros...could you please help in this regard...
but i'm getting syntax error as below.
| Code: |
SYNCSORT FOR Z/OS 1.3.1.0R U.S. PATENTS: 4210961, 5117495 (C) 2007 SYNCSO
z/OS 1.11.0
SYNCSORT LICENSED FOR CPU SERIAL NUMBER 29773, MODEL 2096 V02 LICEN
SYSIN :
INREC IFTHEN=(WHEN=INIT,OVERLAY=(243:C'1',244:7,15)),
IFTHEN=(WHEN=GROUP,BEGIN=(01,03,CH,EQ,C'HDR'),
*
PUSH=(235:ID=8)),
IFTHEN=(WHEN=(01,03,CH,EQ,C'HDR'),OVERLAY=(243:C'0000')),
IFTHEN=(WHEN=(01,03,CH,EQ,C'TLR'),OVERLAY=(243:C'9999'))
SORT FIELDS=(235,8,ZD,A,243,4,CH,A),EQUALS
SUM FIELDS=NONE
OUTFIL IFTRAIL=(HD=YES,TRLID=(1,3,CH,EQ,C'TLR'),
*
TRLUPD=(165:COUNT=(M11,LENGTH=10))),BUILD=(1,234)
WER268A INREC STATEMENT : SYNTAX ERROR
WER268A OUTFIL STATEMENT : SYNTAX ERROR
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000 |
|
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
| You have Syncsort, so lurking in the wrong forum all this time. |
|
| Back to top |
|
 |
ram_vizag
Active User
Joined: 21 Aug 2008 Posts: 112 Location: hyd
|
|
|
|
| Bill Woodger wrote: |
| You have Syncsort, so lurking in the wrong forum all this time. |
Hi bill,
Plesae suggest how to proceed then... |
|
| Back to top |
|
 |
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
| Some kind moderator will probably move it to the correct place. In the meantime - read the Syncsort manuals for your level of Syncsort and check if IFTHEN exists and, if it does, what the syntax is and correct as necessary. |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Anything which is "formatted" for people to read should be in the Code tags.
Looks like (your) Syncsort doesn't have when=group and trlupd. Check your manual for what is available to you, find out when your Syncsort will be upgraded. |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
IFTHEN has been supported since sometime in the 1.3 release. WHEN=GROUP is also supported at this release.
IFTRAIL is not supported in the newest release (1.4). |
|
| Back to top |
|
 |
enrico-sorichetti
Superior Member

Joined: 14 Mar 2007 Posts: 10900 Location: italy
|
|
|
|
have You noticed that people use the code tags to make things more readable ?
what is that You do not understand when somebody asks You to ?
| Quote: |
| Please post sample input using code tags. |
your posts edited to make things more comfortable for people trying to help |
|
| Back to top |
|
 |
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
ram_vizag,
I don't hae Syncsort documentation to see which function is supported in which release.
Try to remove entire OUTFIL statement from your sort card and see if the jobs run successfully. This should give you an idea if your job fails on GROUP or IFTRAIL.
| Quote: |
| out put : 6:3 is filed to be sorted. |
Regardless, because your sort key is 15 bytes, you wouldn't have gotten correct results as your original sample input shows sort key for 3 bytes. So just changing OVERLAY for different key field wouldn't work, you also need to change number of 0s and 9s populated for header and trailer records.
Thanks, |
|
| Back to top |
|
 |
ram_vizag
Active User
Joined: 21 Aug 2008 Posts: 112 Location: hyd
|
|
|
|
| sqlcode1 wrote: |
ram_vizag,
I don't hae Syncsort documentation to see which function is supported in which release.
Try to remove entire OUTFIL statement from your sort card and see if the jobs run successfully. This should give you an idea if your job fails on GROUP or IFTRAIL.
| Quote: |
| out put : 6:3 is filed to be sorted. |
Regardless, because your sort key is 15 bytes, you wouldn't have gotten correct results as your original sample input shows sort key for 3 bytes. So just changing OVERLAY for different key field wouldn't work, you also need to change number of 0s and 9s populated for header and trailer records.
Thanks, |
| Code: |
HDR 2011-11-03
CST
CST CR 000059133814139
CST HN BATEAU HN BATEAU
CST NOT AVAILABLE NOT AVAILABLE
CST RF424E RF424E
CST 000000000000001000000000000001
CST 000000000000003000000000000003
CST 000005120809758000005120809758
CST 000021113827530000021113827530
CST 000024093757097000024093757097
CST 000054143235374000054143235374
CST 000054143833484000054143833484
CST 000054144038386000054144038386
CST 000054150138460000054150138460
CST 000054152913304000054152913304
CST 000074125334080000074125334080
CST 000076134958506000076134958506
CST 000080110129237000080110129237
TLR 0000000018
|
Hi sqlcode1,
the above is records in a file...i have used the following code to get the required out put...
| Code: |
INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:C'1')),
IFTHEN=(WHEN=(1,1,CH,EQ,C'H'),OVERLAY=(81:C'0000')),
IFTHEN=(WHEN=(1,1,CH,EQ,C'T'),OVERLAY=(81:C'9000'))
SORT FIELDS=(81,1,CH,A,7,15,CH,A)
OUTREC FIELDS=(1,80) |
i'm getting header and trailer but i want the date and the record count as well in my output file...the output file i'm getting now is..
| Code: |
HDR
CST
CST CR 000059133814139
CST HN BATEAU HN BATEAU
CST NOT AVAILABLE NOT AVAILABLE
CST RF424E RF424E
CST 000000000000001000000000000001
CST 000000000000003000000000000003
CST 000005120809758000005120809758
CST 000005120809758000005120809758
CST 000021113827530000021113827530
CST 000024093757097000024093757097
CST 000054143235374000054143235374
CST 000054143833484000054143833484
CST 000054144038386000054144038386
CST 000054150138460000054150138460
CST 000054152913304000054152913304
CST 000074125334080000074125334080
CST 000076134958506000076134958506
CST 000080110129237000080110129237
TLR |
please suggest to go further... |
|
| Back to top |
|
 |
enrico-sorichetti
Superior Member

Joined: 14 Mar 2007 Posts: 10900 Location: italy
|
|
|
|
why in hell You keep ignoring the simple requests made by people helping You ?
( use the code tags for readability )
Your posts were again edited for readability to add the code tags
next time You will get an official warning |
|
| Back to top |
|
 |
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
ram_vizag,
Unless you are not showing complete picture, there is no way anyone can help you. You are showing date present on the HDR record and based on your card, I don't see any reason why it would get dropped from the output. Same is the case with TRL/TLR record. Is the date and count present after 80th position?
Also you are not removing duplicates.
See if below helps(TESTED ON DFSORT)...
| Code: |
//STEP0001 EXEC PGM=SORT
//SORTIN DD *
HDR 2011-11-03
CST
CST CR 000059133814139
CST HN BATEAU HN BATEAU
CST NOT AVAILABLE NOT AVAILABLE
CST RF424E RF424E
CST 000000000000001000000000000001
CST 000000000000001000000000000001
CST 000000000000003000000000000003
CST 000005120809758000005120809758
CST 000021113827530000021113827530
CST 000024093757097000024093757097
CST 000054143235374000054143235374
CST 000054143833484000054143833484
CST 000054144038386000054144038386
CST 000054150138460000054150138460
CST 000054152913304000054152913304
CST 000074125334080000074125334080
CST 000076134958506000076134958506
CST 000080110129237000080110129237
TLR 0000000019
//SORTOUT DD SYSOUT=*
//SYSIN DD *
INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:C'1')),
IFTHEN=(WHEN=(1,1,CH,EQ,C'H'),OVERLAY=(81:C'0')),
IFTHEN=(WHEN=(1,1,CH,EQ,C'T'),OVERLAY=(81:C'9'))
SORT FIELDS=(81,1,CH,A,7,15,CH,A),EQUALS
SUM FIELDS=NONE
OUTREC IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'HDR'),PUSH=(82:1,80))
OUTFIL REMOVECC,OMIT=(1,3,SS,EQ,C'HDR,TLR'),BUILD=(1,80),
HEADER1=('HDR',27X,DATE=(4MD-)),
TRAILER1=('TLR',07X,COUNT=(M11,LENGTH=10))
/*
//SYSOUT DD SYSOUT=*
//*
|
OUTPUT
| Code: |
HDR 2011-11-04
CST
CST CR 000059133814139
CST HN BATEAU HN BATEAU
CST NOT AVAILABLE NOT AVAILABLE
CST RF424E RF424E
CST 000000000000001000000000000001
CST 000000000000003000000000000003
CST 000005120809758000005120809758
CST 000021113827530000021113827530
CST 000024093757097000024093757097
CST 000054143235374000054143235374
CST 000054143833484000054143833484
CST 000054144038386000054144038386
CST 000054150138460000054150138460
CST 000054152913304000054152913304
CST 000074125334080000074125334080
CST 000076134958506000076134958506
CST 000080110129237000080110129237
TLR 0000000018 |
Thanks, |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
| Quote: |
| I don't hae Syncsort documentation to see which function is supported in which release. |
Nonsense. . . If your organization is licensed to use the product all of the material is free from Syncsort Support. |
|
| Back to top |
|
 |
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
dick,
At my organization, we have DFSort and that's why I don't have Syncsort documentation.
Thanks, |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Sorry 'bout that - i mis-read and thought this came from TS. . .
d |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|