Page 1 of 1

problem with my first PARSE

PostPosted: Wed Jun 22, 2011 11:17 pm
by wout
Hi, I have a problem with my first parse. There is 1 colum where the result is not like it must be.

input file:
111264;K0013;9326;203284779;2;EBD;
118509;K7099;5756;10018516;2;EBD;
114889;KD333;7951;404021727;2;EBD;
114890;KD333;8143;429758696;2;EBD;
113067;KD333;7962;456366588;2;EBD;
116066;KG391;9337;403269481;2;EBD;
111767;K0978;5296;419589633;2;EBD;
110477;K2117;7509;406005772;2;EBD;
110476;K2117;7506;406820770;2;EBD;


output file :

111264K00139326     203284779 20EBD
118509K70995756     10018516  20EBD
114889KD3337951     404021727 20EBD
114890KD3338143     429758696 20EBD
113067KD3337962     456366588 20EBD
116066KG3919337     403269481 20EBD
111767K09785296     419589633 20EBD
110477K21177509     406005772 20EBD
110476K21177506     406820770 20EBD


wanted output file

111264K00139326     203284779 02EBD
118509K70995756     10018516  02EBD
114889KD3337951     404021727 02EBD
114890KD3338143     429758696 02EBD
113067KD3337962     456366588 02EBD
116066KG3919337     403269481 02EBD
111767K09785296     419589633 02EBD
110477K21177509     406005772 02EBD
110476K21177506     406820770 02EBD


Parse statement:

OPTION COPY
INREC PARSE=(%00=(ENDBEFR=C';',FIXLEN=06),
               %01=(ENDBEFR=C';',FIXLEN=05),
               %02=(ENDBEFR=C';',FIXLEN=09),
               %03=(ENDBEFR=C';',FIXLEN=10),
               %04=(ENDBEFR=C';',FIXLEN=02),
               %05=(ENDBEFR=C';',FIXLEN=03),
               %06=(FIXLEN=15)),
  BUILD=(1:%00,
              7:%01,
             12:%02,
             21:%03,
             31:%04,ZD,EDIT=(TT),
             33:%05,
             36:%06)


The problem is for %04 the result is 20 and i need 02.
What am i doing wrong?

Re: problem with my first PARSE

PostPosted: Thu Jun 23, 2011 1:21 am
by Frank Yaeger
You just need to use UFF instead of ZD to convert %04:

          31:%04,UFF,EDIT=(TT),   


When you PARSE the ;2; value, %04 is set to '2 ' (X'F240'). If you use ZD to convert that, it treats it as 20 (Fdsd) and edits it as 20. If you use UFF to convert that, it treats it as 2 and edits it to 02.

Re: problem with my first PARSE

PostPosted: Thu Jun 23, 2011 1:47 am
by wout
thanks for the info