Page 1 of 1

Junk Check in Dec fixed variable

PostPosted: Fri Dec 05, 2008 12:01 am
by wishvanath
Hi

How can i check junk value in FIXED DEC (7,0)
Eg : DCL VAR DEC FIXED(7,0); <- Value in Packed decimal as '00404000'x

I need to check the value for this junk value and if value is not valid i need to move zeros to it.

How can i do it.

Regards,
Viswanath

Re: Junk Check in Dec fixed variable

PostPosted: Fri Dec 05, 2008 12:42 am
by dick scherrer
Hello,

We don't use pl/i at this site, but you might try this:
DCL A DEC FIXED(5,0) INIT(0);
DCL B PIC'99999' INIT('');
DCL C BIN FIXED(15) INIT(0);

A=1234;
B=A;
C = VERIFY(B,'0123456789');

C will be 0, since it is numeric.

Ex: A = 123A;

C will be 4. --> gives the position of the non numeric.

------

If A is decimal value, define appropriate pic variable, in verify string add . (decimal point).