I have one requirement in my project wherein I need to sort a file and select a particular record depending on some condition.
The file is FB and LRECL is 13. Merchant no is 10 byte and Region ID is 3 byte.
The structure of file to be sorted is as follows:
Merchant No Region
1111111111 CCC or UUU (Only 1 can exist at a time)
Now the requirement is to maintain only 1 record among these records by giving precedence to region as follows:
FFF > GGG > (CCC/UUU) > UNK
i.e. if a merchant exists in FFF and GGG then I need to retain only FFF.
If it exists in GGG and (CCC or UUU) I need to retain only GGG.
If it exists in all regions I need to retain only FFF.
If it exists in only one region I need to retain that record as is.
So output of above file should be
Is this possible using a sort card in minimum number of steps?