Page 2 of 2

Re: How to check for Spaces in Easytrieve

PostPosted: Fri Oct 12, 2012 8:14 pm
by dick scherrer
Hello,

The question was about using SPACES instead of
IF  some-field  = ‘     ‘


I do not believe there is an issue when placing spaces between quotes. The question was about using (what in COBOL are known as Figurative Constants) SPACES.

I see nothing wrong with your code, it just does not address the question the TS posted.

And, according to the documentation, SPACES can be used to MOVE or compare (IF).

Re: How to check for Spaces in Easytrieve

PostPosted: Fri Oct 12, 2012 8:30 pm
by BillyBoyo
IF fieldname EQ ' '
IF fieldname SPACES


can be coded.

IF fieldname EQ SPACES


cannot.

We would've expected the TS to have some variant of the last, but we'll probably never know for sure. I don't have access at the moment. Perhaps you can "toss it in" and see if you get the error message reported?

Re: How to check for Spaces in Easytrieve

PostPosted: Fri Oct 12, 2012 9:41 pm
by c62ap90
BillyBoyo wrote:
IF fieldname EQ ' '
IF fieldname SPACES


can be coded.

IF fieldname EQ SPACES


cannot.

We would've expected the TS to have some variant of the last, but we'll probably never know for sure. I don't have access at the moment. Perhaps you can "toss it in" and see if you get the error message reported?


As we suspected...
*--- INPUT ---                                       
I-REC          1     80  A                           
FIELDNAME      1      1  A                           
*                                                     
*                                                     
JOB INPUT FILEA    NAME OUTPUT                       
*                                                     
*IF FIELDNAME EQ ' '        * SYNTAX OK               
*IF FIELDNAME SPACES        * SYNTAX OK               
 IF FIELDNAME EQ SPACES     * B082 NAME IS UNDEFINED 
     DISPLAY 'GOT A HIT'                             
     GOTO JOB                                         
 END-IF