Page 1 of 1

How to check whether the Comp variable has Spaces or not .

PostPosted: Wed Nov 02, 2011 5:56 pm
by gauthamnagpur18
Hi ,

How to check whether the Comp variable has Spaces or not .

i tried like this ,

IF Sample-ctr (SUB) = SPACES

but i got compilation error.

i have defined Sample-ctr as S9(4) comp .

Thanks in advance . :)

Thanks ,
Gautham

Re: How to check whether the Comp variable has Spaces or no

PostPosted: Wed Nov 02, 2011 6:49 pm
by Robert Sample
You cannot check a COMP variable for spaces, period. This is because of the definition of a COMP variable -- EVERY POSSIBLE VALUE IS VALID FOR A COMP VARIABLE. If you have a PIC S9(04) COMP variable, and it has X'4040' in it -- the value is 4 times 4096 plus 4 times 16 or 16448. It may LOOK like spaces in a memory dump, but the value is actually 16448, because that's the way COMP variables work.

Re: How to check whether the Comp variable has Spaces or no

PostPosted: Thu Nov 03, 2011 10:43 am
by dick scherrer
Hello,

The code that creates the value should prevent having spaces in the comp field(s) - or any other numeric fields.

It sounds like some bad code was allowed to be implemented and now another bad method is being considered to deal with this. . .

Re: How to check whether the Comp variable has Spaces or no

PostPosted: Thu Nov 03, 2011 11:36 am
by gauthamnagpur18
Thanks dick scherrer & Robert Sample !! :)