I have a comma separated file which needs formatting before loading into a DB2 table. A new value needs to be introduced between 2 fields.
Example:
Input file (LRECL 80, FB):
ROBYN ARIAS,QTR2:05-19-2009,PROG1,LINE1,
NACHI KATHIR,QTR2:05-20-2009,PROG2,LINE2,
SOLAI SAKTHI,QTR2:05-21-2009,PROG3,LINE3,
I want the output to look as follows
Output file (LRECL 80, FB):
ROBYN ARIAS,QTR2:05-19-2009,PROG1,05-19-2009,LINE1,
NACHI KATHIR,QTR2:05-20-2009,PROG2,05-20-2009,LINE2,
SOLAI SAKTHI,QTR2:05-21-2009,PROG3,05-21-2009,LINE3,
If you notice, on first line, between PROG1 and LINE1, a date of 05-19-2009 is introduced which is nothing but the date taken from second column value 'QTR2:05-19-2009'. In similar, second line is introduced with date taken from 2nd column value 'QTR2:05-20-2009'.
I used the foll. SYSIN card which introduced the date
Code: Select all
OPTION COPY
OUTREC PARSE=(%00=(ENDBEFR=C',',FIXLEN=25),
%01=(ENDBEFR=C':',FIXLEN=04),
%02=(ENDBEFR=C',',FIXLEN=10),
%03=(ENDBEFR=C',',FIXLEN=5),
%04=(ENDBEFR=C',',FIXLEN=5)),
BUILD=(1:%00,26:C',',
27:%01,31:C':',
32:%02,42:C',',
43:%03,48:C',',
49:%02,59:C',',
60:%04)
ROBYN ARIAS ,QTR2:05-19-2009,PROG1,05-19-2009,LINE1
NACHI KATHIR ,QTR2:05-20-2009,PROG2,05-20-2009,LINE2
SOLAI SAKTHI ,QTR2:05-21-2009,PROG3,05-21-2009,LINE3
Now I have to remove the trailing spaces without altering the space in between names in the first column.
How can this be done? Can you please help me?
Thanks,
Nachi