On Mon, 30 Sep 2019 13:48:11 -0500, Bill Giannelli wrote:

>My statement is as follows:
>SELECT                                                
>     WHEN ssid = "XXXX" THEN grp = "ZZZZ"             
>        
>     WHEN ssid = " " THEN say 'subsystem not entered';
>                          call code                   
>OTHERWISE                                             
>          NOP                                         
>END                   
>
>I thought it was falling though when SSID was blank.
>But what I neglected was a null value for SSID.
>
My refactoring; my personal style:

SIGNAL ON NOVALUE /* Strongly recommended to trap unassigned variables.  */

ssid = " "  /* or something else to test.  */

SELECT
     WHEN ssid = "XXXX" THEN grp = "ZZZZ"

/*        Use "==" for literal comparison.
*/
     WHEN ssid = "XXXX" THEN grp = "ZZZZ"

     WHEN ssid= = " " THEN
                     DO blank_ssid = 42 until 1
                          say 'subsystem not entered';
                          call code
                          RETURN     /* In order not to fall through.  */
                     END blank_ssid  /* Label DO for legibility.  */
     OTHERWISE
          NOP
END

code:  PROCEDURE EXPOSE ssid
     SAY "code was called when ssid = """ssid""""
     RETURN

-- gil

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to