File1: LRECL=91,RECFM=FB
File1 contains 3 digit card member country code starting at position 17 and merchant country code starting at position 34
File2: LRECL=80 and RECFM=FB
File2 is a country to market mapping file where country code is 3 digits and starts at position 10 followed by 2 spaces
and then by 4 digit market-ID.
Rules:-
I want to map card member (CM) country to CM market and merchant country to merchant market using country to mapping file. In output file CM market starts at position 17 and merchant market starts at position 35.
If country code is present in file1 is not present in mapping file (i.e. file2) then market has to be defaulted to 0099.
If country code is spaces then market has to be defaulted to spaces.
Currently I am doing this in 2 steps.
Step1: Map CM country to CM market using following control statements.
JOINKEYS FILES=F1,FIELDS=(17,03,A)
JOINKEYS FILES=F2,FIELDS=(10,03,A)
JOIN UNPAIRED,F1
REFORMAT FIELDS=(F1:1,91,
F2:1,80)
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=(17,03,CH,GT,C' ',AND,101,03,CH,EQ,C' '),
BUILD=(1:1,16,17:C'0099',21:20,72)),
IFTHEN=(WHEN=(17,03,CH,EQ,C' '),
BUILD=(1:1,16,17:C'0099',21:20,72)),
IFTHEN=(WHEN=(17,03,CH,GT,C' ',AND,101,03,CH,NE,C' '),
BUILD=(1:1,16,17:106,4,21:20,72))
OUTREC FIELDS=(1,92)
JOINKEYS FILES=F2,FIELDS=(10,03,A)
JOIN UNPAIRED,F1
REFORMAT FIELDS=(F1:1,91,
F2:1,80)
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=(17,03,CH,GT,C' ',AND,101,03,CH,EQ,C' '),
BUILD=(1:1,16,17:C'0099',21:20,72)),
IFTHEN=(WHEN=(17,03,CH,EQ,C' '),
BUILD=(1:1,16,17:C'0099',21:20,72)),
IFTHEN=(WHEN=(17,03,CH,GT,C' ',AND,101,03,CH,NE,C' '),
BUILD=(1:1,16,17:106,4,21:20,72))
OUTREC FIELDS=(1,92)
Then I map merchant country to market in next step.(Rules are same)
Step2: Map merchant country to merchant market.
JOINKEYS FILES=F1,FIELDS=(35,03,A)
JOINKEYS FILES=F2,FIELDS=(10,03,A)
JOIN UNPAIRED,F1
REFORMAT FIELDS=(F1:1,92,
F2:1,80)
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=(35,03,CH,GT,C' ',AND,102,03,CH,EQ,C' '),
BUILD=(1:1,34,35:C'0099',39:38,55)),
IFTHEN=(WHEN=(35,03,CH,EQ,C' '),
BUILD=(1:1,34,35:C'0099',39:38,55)),
IFTHEN=(WHEN=(35,03,CH,GT,C' ',AND,102,03,CH,NE,C' '),
BUILD=(1:1,34,35:107,4,39:38,55))
OUTREC FIELDS=(1,93)
JOINKEYS FILES=F2,FIELDS=(10,03,A)
JOIN UNPAIRED,F1
REFORMAT FIELDS=(F1:1,92,
F2:1,80)
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=(35,03,CH,GT,C' ',AND,102,03,CH,EQ,C' '),
BUILD=(1:1,34,35:C'0099',39:38,55)),
IFTHEN=(WHEN=(35,03,CH,EQ,C' '),
BUILD=(1:1,34,35:C'0099',39:38,55)),
IFTHEN=(WHEN=(35,03,CH,GT,C' ',AND,102,03,CH,NE,C' '),
BUILD=(1:1,34,35:107,4,39:38,55))
OUTREC FIELDS=(1,93)
Can I do these two mappings in 1 step?