From: Paul Gilmartin <[EMAIL PROTECTED]>
Let me see if I understand this:

    SET RED = 'WOMBAT'
    SET COLOR = RED
    PRINT &&COLOR    /* Prints 'WOMBAT', Doesn't it? */


The CLIST syntax to display WOMBAT would be as follows:

SET RED = WOMBAT     /* No quotes required */
SET COLOR = &RED      /* Ampersand required */
WRITE &COLOR         /* WRITE instead of PRINT, with one ampersand */

Line 1 assigns a variable called RED with a literal value called WOMBAT. Line 2 assigns a variable called COLOR with the contents of a variable called RED, so COLOR is set to WOMBAT. Line 3 displays the contents of the variable COLOR, so WOMBAT is displayed.


    SET RED = 'Uninitialized'
    SET COLOR = RED
    SET &COLOR = 'WOMBAT'
    PRINT &&COLOR   /* Prints what?  I'd hope for 'WOMBAT'.  */


The CLIST syntax for the above would look like this:

SET RED = &Z
SET COLOR = &RED
SET &COLOR = WOMBAT
WRITE &COLOR

The first line sets a variable called RED to a null value. The second line sets a variable called COLOR to the value of a variable called RED, which was previously set to null. In other words, the value of COLOR is set to null. The third line sets a variable called COLOR to a literal value called WOMBAT. Note that the ampersand on line 3 is optional, so line 3 works exactly the same way line 2 works; in other words, line 3 simply clobbers the assignment that was made on line 2. The fourth line displays the value of the variable &COLOR, which of course is WOMBAT. In other words, lines 1 and 2 are completely redundant as they have no effect whatsoever on lines 3 and 4.

Hope this helps,

Dave Salt
SimpList(tm) - The easiest, most powerful way to surf a mainframe!
http://www.mackinney.com/products/SIM/simplist.htm

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to