If condition not working properly



TSO Programming, ISPF, SDF, SDSF and PDF, FTP, TCP/IP Concepts, SNA & SNA/IP etc...

If condition not working properly

Postby nikesh_rai » Fri May 18, 2012 4:45 pm

Hi,

I have codded the if condition in my panel as below:

IF ((&ZSYSID = 'F01' and &XSUBSYS = 'DBF1' ) or
(&ZSYSID = 'VIL' and &XSUBSYS = 'DBCD' ))

.MSG=200
ELSE
.MSG=300

the issue is, "or" is not working here and giving logical error

ISPP169

Panel 'PAN12' error
Invalid IF logical expression (not a dialog or control variable or VER
statement construct).

Panel line where error was detected:
IF ((&ZSYSID = 'F01' and &XSUBSYS = 'DBF1' ) or

Can someone please help me to resolve the issue..???
Thanks
Nikesh Rai
nikesh_rai
 
Posts: 205
Joined: Tue Oct 18, 2011 1:27 am
Has thanked: 17 times
Been thanked: 0 time

Re: If condition not working properly

Postby Pedro » Fri May 18, 2012 6:46 pm

I do not think nested parenthesis are supported.
Pedro Vera
User avatar
Pedro
 
Posts: 686
Joined: Thu Jul 31, 2008 9:59 pm
Location: Silicon Valley
Has thanked: 0 time
Been thanked: 53 times

Re: If condition not working properly

Postby mongan » Fri May 18, 2012 8:42 pm

First, you do not use OR or AND, you use the OR symbol for example (!) and the AND symbol &
Second, indentation is very important in Panels. That is why you should post using the Code Markers so that we can see this.
if (VER (&name,NB,NAME) ! &name = '*')
else                                 

Third, try a different way or use the rexx exit to do what you want.
User avatar
mongan
 
Posts: 211
Joined: Tue Jan 11, 2011 8:32 pm
Has thanked: 1 time
Been thanked: 5 times

Re: If condition not working properly

Postby Pedro » Fri May 18, 2012 9:11 pm

First, you do not use OR or AND, you use the OR symbol for example (!) and the AND symbol &

Your meaning is not clear... are you referring to style or preference? Because, from the book:
Boolean-operator                                                           
    The character symbol & or characters AND (AND Boolean operator) or the
    character symbol | or characters OR (OR Boolean operator).             


This worked for me (only one set of parenthesis):
IF  (&ZSYSID = 'F01' and &XSUBSYS = 'DBF1'   or
     &ZSYSID = 'VIL' and &XSUBSYS = 'DBCD'  )   


Though, you probably need to split up into multiple statements to get the grouping that you intended through parenthesis. Or use imbedded rexx (preferred over a rexx exit for this instance).

I am not sure of the internal logic of ISPF, but it seems like the first right paren ends the conditional expression. They should give a more specific message, like 'Nested parenthesis are not supported', which I think should be the first indication of a syntax error.
Pedro Vera
User avatar
Pedro
 
Posts: 686
Joined: Thu Jul 31, 2008 9:59 pm
Location: Silicon Valley
Has thanked: 0 time
Been thanked: 53 times


Return to TSO & ISPF

 


  • Related topics
    Replies
    Views
    Last post