I need help in sorting a file based on two binary defined variables (postion 9 to 11 and postion 21 to 23). The position 9 to 11 needs to considered for A type record and 21 to 23 for B type records. The expected output should have 9 to 11 and 21 to 23 in ascending order.
I know there are ways to do this in DFSORT but i couldn't do it using Syncsort. We only have Syncsort at our office.
Input:
A xxxxx 111 xxxxx yyyyy ddddd
B xxxxx xxxxx xxxxx 119 ddddd
A xxxxx 114 xxxxx yyyyy ddddd
A xxxxx 118 xxxxx yyyyy ddddd
A xxxxx 111 xxxxx yyyyy ddddd
B xxxxx xxxxx xxxxx 111 ddddd
B xxxxx xxxxx xxxxx 118 ddddd
B xxxxx xxxxx xxxxx 114 ddddd
Expected output:
A xxxxx 111 xxxxx yyyyy ddddd
B xxxxx xxxxx xxxxx 111 ddddd
A xxxxx 111 xxxxx yyyyy ddddd
A xxxxx 114 xxxxx yyyyy ddddd
B xxxxx xxxxx xxxxx 114 ddddd
A xxxxx 118 xxxxx yyyyy ddddd
B xxxxx xxxxx xxxxx 118 ddddd
B xxxxx xxxxx xxxxx 119 ddddd
I tried writing a DFSORT control card for the same:
INCLUDE COND=(5,1,CH,EQ,C'A',OR,
5,1,CH,EQ,C'T')
INREC
IFTHEN=(WHEN=(730,4,BI,EQ,405),OVERLAY=(3794:405)),
IFTHEN=(WHEN=(730,4,BI,EQ,406),OVERLAY=(3794:406)),
IFTHEN=(WHEN=(730,4,BI,EQ,407),OVERLAY=(3794:407)),
IFTHEN=(WHEN=(730,4,BI,EQ,408),OVERLAY=(3794:408)),
IFTHEN=(WHEN=(730,4,BI,EQ,409),OVERLAY=(3794:409)),
IFTHEN=(WHEN=(730,4,BI,EQ,410),OVERLAY=(3794:410)),
IFTHEN=(WHEN=(730,4,BI,EQ,411),OVERLAY=(3794:411)),
IFTHEN=(WHEN=(730,4,BI,EQ,412),OVERLAY=(3794:412)),
IFTHEN=(WHEN=(730,4,BI,EQ,413),OVERLAY=(3794:413)),
IFTHEN=(WHEN=(730,4,BI,EQ,414),OVERLAY=(3794:414)),
IFTHEN=(WHEN=(112,4,BI,EQ,405),OVERLAY=(3794:405)),
IFTHEN=(WHEN=(112,4,BI,EQ,406),OVERLAY=(3794:406)),
IFTHEN=(WHEN=(112,4,BI,EQ,407),OVERLAY=(3794:407)),
IFTHEN=(WHEN=(112,4,BI,EQ,408),OVERLAY=(3794:408)),
IFTHEN=(WHEN=(112,4,BI,EQ,409),OVERLAY=(3794:409)),
IFTHEN=(WHEN=(112,4,BI,EQ,410),OVERLAY=(3794:410)),
IFTHEN=(WHEN=(112,4,BI,EQ,411),OVERLAY=(3794:411)),
IFTHEN=(WHEN=(112,4,BI,EQ,412),OVERLAY=(3794:412)),
IFTHEN=(WHEN=(112,4,BI,EQ,413),OVERLAY=(3794:413)),
IFTHEN=(WHEN=(112,4,BI,EQ,414),OVERLAY=(3794:414))
SORT FIELDS=(3794,3,CH,A)
REMOVECC,BUILD=(1,3793)
This control card doesn't exactly match the file mentioned above in my post, but for the real production file. I tried running it and then understood that IFTHEN and WHEN are not supported by SYNCSORT. Hence I turned to our forum to look out for help.
Expected output:
A xxxxx 111 xxxxx yyyyy ddddd
B xxxxx xxxxx xxxxx 111 ddddd
A xxxxx 111 xxxxx yyyyy ddddd
If my understanding on your requirement is correct, first 3 records of the expected output should be as below since B type record (with 111) in the input appears next to the 2 A type records (with 111).
A xxxxx 111 xxxxx yyyyy ddddd
A xxxxx 111 xxxxx yyyyy ddddd
B xxxxx xxxxx xxxxx 111 ddddd
As dick said your understanding on SYNCSORT is wrong. Did you refer the manual before concluding yourself?
Quote:
Hence I turned to our forum to look out for help
Did you search the forum to check whether IFTHEN and WHEN is supported by SYNCSORT? You can see many posts regarding IFTHEN and WHEN in the forum. Don't assume anything.
I tried running it and then understood that IFTHEN and WHEN are not supported by SYNCSORT
What error you got and why did you conclude that SYNCSORT does not support this? If you can post your error people can come up with some points (may be you have used it wrongly).
Check the below sort card in case if you have the cuurent version of Syncsort installed.
I have assumed the record length as 80 and there are only A and B type records. This code is tested. Check this and let us know whether this works for your requirement.
IFTHEN and OVERLAY have been supported since SyncSort for z/OS 1.2.1. Which release of SyncSort are you currently running? And as previously requested, what error did you receive when you attempted to submit the job?