Convert ZD to decimal value and remove the leading zeroes



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Convert ZD to decimal value and remove the leading zeroes

Postby gauthamnagpur18 » Mon Sep 14, 2015 7:37 am

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.
gauthamnagpur18
 
Posts: 93
Joined: Sat Oct 23, 2010 1:28 pm
Location: Chennai, India
Has thanked: 3 times
Been thanked: 3 times

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

Postby gauthamnagpur18 » Mon Sep 14, 2015 7:47 am

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
gauthamnagpur18
 
Posts: 93
Joined: Sat Oct 23, 2010 1:28 pm
Location: Chennai, India
Has thanked: 3 times
Been thanked: 3 times

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

Postby BillyBoyo » Mon Sep 14, 2015 4:33 pm

 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.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post