Page 1 of 1

Wildcards / Masked IF Statement

PostPosted: Fri Sep 25, 2009 11:33 pm
by qz2s4m
Is there a way to wildcard expression on an IF statement for the z/OS version of EasyTreive?

For example, to code:

IF NAME = 'A*'

So that the IF statement proves true for all instances where the field NAME has an A in the first position, such as A or A1 or ABC and so on.

Thanks
Duane W.

Re: Wildcards / Masked IF Statement

PostPosted: Sat Sep 26, 2009 12:06 am
by dick scherrer
Hello,

Did you try to compare a multi-character field with an 'A'? What happened? I'm not able to test just now, but i seem to recall that (unlike cobol) Easytrieve would use the length of the "first" field (the subject) for the comparison.

A bit later. . .
Found this in the doc:
The comparison is based on the greater of the length of the subject and the
length of the object. The shorter item is padded with spaces to the length of
the longer item. For downward compatibility with existing Unicenter
CA-Easytrieve programs, this rule is subject to the following exception:
– When a fixed length subject is compared with a longer fixed length
object, the comparison is based on the length of the subject.


The bold and italics are mine, not the manual. Please try
IF 'A' = NAME

Re: Wildcards / Masked IF Statement

PostPosted: Wed Sep 30, 2009 9:37 pm
by qz2s4m
Thanks for the reply Dick.

I did try the following: IF FORM = 'REM' and got no results since values are thing like REMC or REMS. That is to be expected with the comment you added on how Easytrieve function.

I was not able to code : IF 'REM' = FORM

That resulted in an error indicating the subject must be a field or file. It will not accept a string value.

Though using that blurb you provided I could make the subject shorter than the compare field to acheive the results example:

SRCH W 3 A.

SRCH = 'REM'

IF SRCH = FORM

This allowed for any value in the form field that began with REM to be a positive match.

I also was able to use the THRU parameter to achieve the results as well:

IF FORM = 'REM' THRU 'REM9999'

Thanks again for the reply.

Re: Wildcards / Masked IF Statement

PostPosted: Wed Sep 30, 2009 11:46 pm
by dick scherrer
Good to hear it is working - thanks for posting your solutions :)

d