Page 1 of 1

Convert ZD to decimal value and remove the leading zeroes

PostPosted: Mon Sep 14, 2015 7:37 am
by gauthamnagpur18
Hi,

I need a help .

Need to convert ZD to decimal value and remove the leading zeroes.

Also a value of 0.00 should be displayed as space..

I tried using OUTREC OVERLAY=(102:102,10,ZD,EDIT=(IIIIIII.II),
112:112,10,ZD,EDIT=(IIIIIII.II))

The problem here is if the value is .10 , then I don't get the decimal point..It is just displayed as 10
0.00 should be displayed as spaces
0.10 should be displayed as .10 in the final output.

Can you please help me out.

Re: Convert ZD to decimal value and remove the leading zeroe

PostPosted: Mon Sep 14, 2015 7:47 am
by gauthamnagpur18
Using this option OUTREC OVERLAY=(102:102,10,ZD,EDIT=(IIIIIIt.tt),
112:112,10,ZD,EDIT=(IIIIIIt.tt))
will give 0.00 and 0.10, but the expected output is spaces and .10 respectively

Re: Convert ZD to decimal value and remove the leading zeroe

PostPosted: Mon Sep 14, 2015 4:33 pm
by BillyBoyo
 INREC OVERLAY=(102:102,10,ZD,EDIT=(IIIIIII.TT),
                112:112,10,ZD,EDIT=(IIIIIII.TT))


Since OUTREC has no special powers (beyond where it runs, after the data is SORTed and SUMmed) I have changed it to INREC. If indeed you are SORTing, change it back.

For information, you are losing the most signification digit from each field, if that can contain a non-zero.

The output formatting you want cannot be done directly with an EDIT. Since EDIT does most of what you want, use it and change the data afterwards.

Because you have two fields, you'd need four IFTHENs (one pair for each field) and you'd need HIT=NEXT and some care. Simpler may be to use CHANGE twice for each field (partial) in the OVERLAY, or separately putting a WHEN=INIT for each. Or use FINDREP in two pairs, limiting the search with STARTPOS end ENDPOS.