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:
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)))
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.
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.
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...
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).
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...
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.
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.
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.
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
Joined: 10 May 2007 Posts: 2455 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.
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.
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.
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.
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.