I am decomposing a .cvs file into a fixed column length one using the following CNTL:
OPTION VLSHRT
RECORD TYPE=V,LENGTH=300
OUTFIL PARSE=(%01=(ABSPOS=6,ENDBEFR=C'","',FIXLEN=7),
%02=(ENDBEFR=C'","',FIXLEN=42),
%03=(ENDBEFR=C'","',FIXLEN=8),
%04=(ENDBEFR=C'","',FIXLEN=3),
%05=(ENDBEFR=C'","',FIXLEN=37),
%06=(ENDBEFR=C'","',FIXLEN=32),
%07=(ENDBEFR=C'","',FIXLEN=26),
%08=(ENDBEFR=C'","',FIXLEN=18),
%09=(ENDBEFR=C'","',FIXLEN=19),
%10=(ENDBEFR=C'","',FIXLEN=1),
%11=(ENDBEFR=C'","',FIXLEN=1),
%12=(ENDBEFR=C'","',FIXLEN=8),
%13=(ENDBEFR=C'","',FIXLEN=20),
%14=(ENDBEFR=C'"',FIXLEN=16)),
VTOF,
BUILD=(%02,
%01,
%04,
%05,
%03,
%09,JFY=(SHIFT=RIGHT),
%06,
%07,
%08,
%10,
%11,
%12,
%13)
RECORD TYPE=V,LENGTH=300
OUTFIL PARSE=(%01=(ABSPOS=6,ENDBEFR=C'","',FIXLEN=7),
%02=(ENDBEFR=C'","',FIXLEN=42),
%03=(ENDBEFR=C'","',FIXLEN=8),
%04=(ENDBEFR=C'","',FIXLEN=3),
%05=(ENDBEFR=C'","',FIXLEN=37),
%06=(ENDBEFR=C'","',FIXLEN=32),
%07=(ENDBEFR=C'","',FIXLEN=26),
%08=(ENDBEFR=C'","',FIXLEN=18),
%09=(ENDBEFR=C'","',FIXLEN=19),
%10=(ENDBEFR=C'","',FIXLEN=1),
%11=(ENDBEFR=C'","',FIXLEN=1),
%12=(ENDBEFR=C'","',FIXLEN=8),
%13=(ENDBEFR=C'","',FIXLEN=20),
%14=(ENDBEFR=C'"',FIXLEN=16)),
VTOF,
BUILD=(%02,
%01,
%04,
%05,
%03,
%09,JFY=(SHIFT=RIGHT),
%06,
%07,
%08,
%10,
%11,
%12,
%13)
and works fine.
however, i need to add an extra filed at the end, which would be a single character, "R" if the first char of field %04% is "R" and "A" if first char of field %04 is "V"
Tried several options including IFTHEN or CHANGE, but successful. Last attempt was :
OPTION VLSHRT
RECORD TYPE=V,LENGTH=300
OUTFIL PARSE=(%01=(ABSPOS=6,ENDBEFR=C'","',FIXLEN=7),
%02=(ENDBEFR=C'","',FIXLEN=42),
%03=(ENDBEFR=C'","',FIXLEN=8),
%04=(ENDBEFR=C'","',FIXLEN=3),
%05=(ENDBEFR=C'","',FIXLEN=37),
%06=(ENDBEFR=C'","',FIXLEN=32),
%07=(ENDBEFR=C'","',FIXLEN=26),
%08=(ENDBEFR=C'","',FIXLEN=18),
%09=(ENDBEFR=C'","',FIXLEN=19),
%10=(ENDBEFR=C'","',FIXLEN=1),
%11=(ENDBEFR=C'","',FIXLEN=1),
%12=(ENDBEFR=C'","',FIXLEN=8),
%13=(ENDBEFR=C'","',FIXLEN=20),
%14=(ENDBEFR=C'"',FIXLEN=16)),
VTOF,
BUILD=(%02,
%01,
%04,
%05,
%03,
%09,JFY=(SHIFT=RIGHT),
%06,
%07,
%08,
%10,
%11,
%12,
%13,
%04,CHANGE=(1,
C'R',C'R',
C'V',C'A'))
RECORD TYPE=V,LENGTH=300
OUTFIL PARSE=(%01=(ABSPOS=6,ENDBEFR=C'","',FIXLEN=7),
%02=(ENDBEFR=C'","',FIXLEN=42),
%03=(ENDBEFR=C'","',FIXLEN=8),
%04=(ENDBEFR=C'","',FIXLEN=3),
%05=(ENDBEFR=C'","',FIXLEN=37),
%06=(ENDBEFR=C'","',FIXLEN=32),
%07=(ENDBEFR=C'","',FIXLEN=26),
%08=(ENDBEFR=C'","',FIXLEN=18),
%09=(ENDBEFR=C'","',FIXLEN=19),
%10=(ENDBEFR=C'","',FIXLEN=1),
%11=(ENDBEFR=C'","',FIXLEN=1),
%12=(ENDBEFR=C'","',FIXLEN=8),
%13=(ENDBEFR=C'","',FIXLEN=20),
%14=(ENDBEFR=C'"',FIXLEN=16)),
VTOF,
BUILD=(%02,
%01,
%04,
%05,
%03,
%09,JFY=(SHIFT=RIGHT),
%06,
%07,
%08,
%10,
%11,
%12,
%13,
%04,CHANGE=(1,
C'R',C'R',
C'V',C'A'))
but did not work. Any ideas would be appreciated. Thanks, GG