View previous topic :: View next topic
Author
Message
trushant.w New User Joined: 22 Sep 2013Posts: 81 Location: pune india
I want to group a records (inpt file pos 34 bytes 4)
like all 5064 will come first then 5099,5087,2356 and then all others will come
Back to top
sureshpathi10 Active User Joined: 03 May 2010Posts: 154 Location: Kuala Lumpur
Hi,
Please search how to code with IFTHEN=(WHEN=GROUP...and post what you've tried here to help you further along with sample input/output.
Back to top
trushant.w New User Joined: 22 Sep 2013Posts: 81 Location: pune india
actually dont want to use build.
And want to keep the in put file as it is after arranging in above sequence
I am not getting when=group syntax without Build
Back to top
sureshpathi10 Active User Joined: 03 May 2010Posts: 154 Location: Kuala Lumpur
Please read the manual for WHEN=GROUP and try to understand the logic of BUILD/OVERLAY used with. Try to code by yourself.
When you don't get your expected result, provide the code here... we will help you out.
BTW, When you post any question, please remember to give any code & example data to work with.
Back to top
trushant.w New User Joined: 22 Sep 2013Posts: 81 Location: pune india
Thanks for replying
I am trying with below
Code:
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=GROUP,BEGIN=(34,4,CH,EQ,C'5375'),
IFTHEN=(WHEN=GROUP,(34,4,CH,EQ,C'5493'),
IFTHEN=(WHEN=GROUP,(34,4,CH,EQ,C'5003'))
IFTHEN=(WHEN=NONE,GROUP)
OUTREC BUILD=(1,213)
But getting below error
Code:
ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R12 - 09:55 ON M
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=GROUP,BEGIN=(34,4,CH,EQ,C'5375'),
IFTHEN=(WHEN=GROUP,(34,4,CH,EQ,C'5493'),
$
ICE006A 0 OPERAND DEFINER ERROR
IFTHEN=(WHEN=GROUP,(34,4,CH,EQ,C'5003'))
$
ICE005A 0 BLANK NEEDED IN COLUMN 1 OR OPERATION NOT DEFINED CORRECTLY
IFTHEN=(WHEN=NONE,GROUP)
$
ICE005A 0 BLANK NEEDED IN COLUMN 1 OR OPERATION NOT DEFINED CORRECTLY
OUTREC BUILD=(1,213)
Back to top
sureshpathi10 Active User Joined: 03 May 2010Posts: 154 Location: Kuala Lumpur
Could you also provide the sample input data and expected output?
Back to top
trushant.w New User Joined: 22 Sep 2013Posts: 81 Location: pune india
Sample Input
Code:
D|20140116|35|632005|04075731094|5793|NOUS|470010|01210289359|1|
D|20140116|35|632005|04071465178|5003|NOUS|470010|01329264876|2|
D|20140116|35|632005|04071465178|5493|NOUS|060060|01329264876|2|
D|20140116|35|632005|04071465178|5793|NOUS|470010|01329264876|2|
D|20140116|35|632005|04075731094|5493|NOUS|053252|00271335920|1|
D|20140116|35|632005|04068707957|5933|ONUS|077799|09077463290|3|
D|20140116|35|632005|04068707957|5264|ONUS|632005|04056129961|1|
D|20140116|35|430000|74000790060|5007|ROUS|632005|09167460568|2|
D|20140116|35|220323|62364820110|5003|ROUS|350000|09071676728|2|
D|20140116|35|632005|04068707957|5933|ONUS|099999|09090399682|2|
Sample output
now i want recotds like
5375
5375
5375
5493
5493
5003
5003
others not mentioned in condition
layout of input n output is same
Back to top
sureshpathi10 Active User Joined: 03 May 2010Posts: 154 Location: Kuala Lumpur
Here is the sort card.
I believe, your input file is fixed and LRECL=213
Code:
SORT FIELDS=(214,1,CH,A)
INREC IFTHEN=(WHEN=(34,4,CH,EQ,C'5375'),OVERLAY=(214:C'1')),
IFTHEN=(WHEN=(34,4,CH,EQ,C'5493'),OVERLAY=(214:C'2')),
IFTHEN=(WHEN=(34,4,CH,EQ,C'5003'),OVERLAY=(214:C'3')),
IFTHEN=(WHEN=NONE,OVERLAY=(214:C'4'))
OUTREC BUILD=(1,213)
input:
Code:
D|20140116|35|632005|04075731094|5793|NOUS|470010|01210289359|1|
D|20140116|35|632005|04071465178|5003|NOUS|470010|01329264876|2|
D|20140116|35|632005|04071465178|5493|NOUS|060060|01329264876|2|
D|20140116|35|632005|04071465178|5793|NOUS|470010|01329264876|2|
D|20140116|35|632005|04075731094|5493|NOUS|053252|00271335920|1|
D|20140116|35|632005|04068707957|5933|ONUS|077799|09077463290|3|
D|20140116|35|632005|04068707957|5264|ONUS|632005|04056129961|1|
D|20140116|35|430000|74000790060|5007|ROUS|632005|09167460568|2|
D|20140116|35|220323|62364820110|5003|ROUS|350000|09071676728|2|
D|20140116|35|632005|04068707957|5933|ONUS|099999|09090399682|2|
Since , there is no "5375" in the input, the output will be
output:
Code:
D|20140116|35|632005|04071465178|5493|NOUS|060060|01329264876|2|
D|20140116|35|632005|04075731094|5493|NOUS|053252|00271335920|1|
D|20140116|35|632005|04071465178|5003|NOUS|470010|01329264876|2|
D|20140116|35|220323|62364820110|5003|ROUS|350000|09071676728|2|
D|20140116|35|632005|04075731094|5793|NOUS|470010|01210289359|1|
D|20140116|35|632005|04068707957|5933|ONUS|099999|09090399682|2|
D|20140116|35|632005|04068707957|5933|ONUS|077799|09077463290|3|
D|20140116|35|632005|04068707957|5264|ONUS|632005|04056129961|1|
D|20140116|35|632005|04071465178|5793|NOUS|470010|01329264876|2|
D|20140116|35|430000|74000790060|5007|ROUS|632005|09167460568|2|
Hope this helps
Back to top
trushant.w New User Joined: 22 Sep 2013Posts: 81 Location: pune india
Thank you so much suresh.
This woks perfectly for me
Back to top
Please enable JavaScript!