Wildcards / Masked IF Statement



Unicenter CA-Easytrieve Plus Report Generator: CA's information retrieval and data management tool

Wildcards / Masked IF Statement

Postby qz2s4m » Fri Sep 25, 2009 11:33 pm

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.
qz2s4m
 
Posts: 7
Joined: Mon Jun 29, 2009 10:08 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Wildcards / Masked IF Statement

Postby dick scherrer » Sat Sep 26, 2009 12:06 am

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

Re: Wildcards / Masked IF Statement

Postby qz2s4m » Wed Sep 30, 2009 9:37 pm

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.
qz2s4m
 
Posts: 7
Joined: Mon Jun 29, 2009 10:08 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Wildcards / Masked IF Statement

Postby dick scherrer » Wed Sep 30, 2009 11:46 pm

Good to hear it is working - thanks for posting your solutions :)

d
User avatar
dick scherrer
Global moderator
 
Posts: 6269
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times


Return to CA-Easytrieve

 


  • Related topics
    Replies
    Views
    Last post