Junk Check in Dec fixed variable



IBM's cross-platform compiler PL/I for MVS, VM & VSE, OS/390 and Enterprise PL/I for z/OS

Junk Check in Dec fixed variable

Postby wishvanath » Fri Dec 05, 2008 12:01 am

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
wishvanath
 
Posts: 1
Joined: Thu Dec 04, 2008 11:56 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Junk Check in Dec fixed variable

Postby dick scherrer » Fri Dec 05, 2008 12:42 am

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).
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times


Return to PL/I

 


  • Related topics
    Replies
    Views
    Last post