View previous topic :: View next topic
Author
Message
vaibhavjadhav New User Joined: 27 Jul 2007Posts: 33 Location: mumbai
Hi,
Could you please help me in writing the below output using PARSE in SORT or ICETOOL.
Explanation:
The input is a comma delimited and want the output to be written as replacing comma with * as shown below. Also the field STATUS and its value in all the records and header should be written as $.
Code:
Input:
POLNO,AGENTNO,STATUS,FREQ,GENDER
00001,001,SP,MONTHLY,MALE
002,02,AP,YEARLY,FEMALE
03,003,AP,HALF,MALE
0004,04,SP,QUARTELY,MALE
00005,005,AP,MONTHLY,FEMALE
Output:
POLNO*AGENTNO*$*FREQ*GENDER
00001*001*$*MONTHLY*MALE
002*02*$*YEARLY*FEMALE
03*003*$*HALF*MALE
0004*04*$*QUARTELY*MALE
00005*005*$*MONTHLY*FEMALE
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
You can use DFSORT statements like the following to do what you asked for:
Code:
OPTION COPY
INREC IFTHEN=(WHEN=INIT,FINDREP=(IN=C',',OUT=C'*')),
IFTHEN=(WHEN=INIT,
PARSE=(%01=(ENDAT=C'*',FIXLEN=10),
%02=(ENDAT=C'*',FIXLEN=10),
%=(ENDBEFR=C'*'),
%03=(FIXLEN=20)),
BUILD=(%01,%02,C'$*',%03)),
IFTHEN=(WHEN=INIT,OVERLAY=(1:1,42,SQZ=(SHIFT=LEFT)))
Back to top
Please enable JavaScript!