×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

setting a list of variables

setting a list of variables

setting a list of variables

(OP)
Hello folks,

I'm trying to check multiple fields against a group of values.  Instead of saying
IF (FIELD1 EQ 'BLAH1' OR 'BLAH2' OR 'BLAH3') OR
   (FIELD2 EQ 'BLAH1' OR 'BLAH2' OR 'BLAH3') OR
   (FIELD3...
I'd like to say
IF (FIELD1 EQ 'ck list of values in the variable') OR
   (FIELD2 EQ 'ck list of values in the variable') OR
   (FIELD3 EQ 'ck list of values in the variable'...

In my attempt to do this, I have something like
-SET &GRP   = 'BLAH1,BLAH2,BLAH3';
and in the DEFINE
IF (FIELD1 EQ '&GRP.EVAL' OR
    FIELD2 EQ '&GRP.EVAL' OR
    FIELD3 EQ '&GRP.EVAL')...

There's obviously something I don't quite understand about what I supposed to do with this.  I'm getting an error msg:
(FOC016) THE TRUNCATED FIELDNAME IS NOT UNIQUE: O
However, there is no 'O' value in my list at all.

Am at all on the right track or do I need to do something entirely different?  Can somebody please clue me?

Thanks--Mary E.


  

RE: setting a list of variables

Mary,

This is a 2 part question. The first, is how to put the values into a variable, for reuse. I'm assuming you used the correct syntax, as separating the values with commas instead of 'OR' doesn't work, and alpha fields must be enclosed in single quotes, like this:

 -SET &COULST = '''ENGLAND'' OR ''FRANCE'' OR ''ITALY''';  
 DEFINE FILE CAR                                           
 TEST/I1 = IF (COUNTRY EQ &COULST) THEN 1 ELSE 0;          
 END                                                       
 TABLE FILE CAR                                            
 PRINT COUNTRY TEST                                        
 END
  

Note the separating 'OR' between values, and the 2 adjacent single quotes within the quoted string, to denote an imbedded single quote.

Now, as to your error, the expanded line must fit into FOCSTACK, which, until recently, had a limit of 80 characters. So, your expanded lines may be exceeding 80 characters, and the record is being truncated at an 'OR', so only the 'O' is seen (just a guess). If you run the procedure with ECHO=ON, you can see what FOCUS sees, which may explain more.

RE: setting a list of variables

(OP)
Hm, that's interestng.  I originally had the ORs, but my manual seems to indicate that I should use commas instead.  Of course, the only manual I have is one for 7.0.  Plus, if our school is still on the 80 char software, this feature won't work for me anyway.

Thanks for the response & I'll try this out!

Mary E.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close