Line 2 is the line I added to correct the prior example that failed. 

-----Original Message-----
From: IBM Mainframe Discussion List [mailto:[email protected]] On
Behalf Of Pommier, Rex R.
Sent: Wednesday, July 18, 2012 2:00 PM
To: [email protected]
Subject: Re: Unsetting a JCL symbol.

But doesn't line 2 set MYSYM to 'INITVAL'?

-----Original Message-----
From: IBM Mainframe Discussion List [mailto:[email protected]] On
Behalf Of Bass, Walter W
Sent: Wednesday, July 18, 2012 10:33 AM
To: [email protected]
Subject: Re: Unsetting a JCL symbol.

Paul,

Note in your example that lines 3 and 4 are NOT followed by message
IEFC653I as they would be if any symbol substitution took place. The
reason your example does not work is because when lines 3 and 4 are
evaluated, &MYSYM has not yet been assigned any value, therefore the JCL
processor does not yet consider it to be a symbol.

On lines 3 and 4 it is treated as a literal and &SAVESYM is set to the
literal value "&MYSYM" rather than the value of the symbol &MYSYM.

If &MYSYM is assigned a value prior to line 3, it works as expected.

2 // SET MYSYM='INITVAL'
3 //BEFORE   EXEC  PGM=IEFBR14,PARM='&MYSYM.X'
  //*
  //***** SAVE CURRENT VALUE OF MYSYM
  IEFC653I SUBSTITUTION JCL - PGM=IEFBR14,PARM='INITVALX'
4 // SET SAVESYM=&MYSYM
  //***** SET MYSYM TO A NEW VALUE
  IEFC653I SUBSTITUTION JCL - SAVESYM=INITVAL
5 // SET MYSYM='NEWVAL'
6 //DURING   EXEC  PGM=IEFBR14,PARM='&MYSYM.X'
  //*
  //***** RESTORE MYSYM
  IEFC653I SUBSTITUTION JCL - PGM=IEFBR14,PARM='NEWVALX'
7 // SET MYSYM=&SAVESYM
  IEFC653I SUBSTITUTION JCL - MYSYM=INITVAL
8 //AFTER    EXEC  PGM=IEFBR14,PARM='&MYSYM.X'
  IEFC653I SUBSTITUTION JCL - PGM=IEFBR14,PARM='INITVALX'

Thanks,
Bill

-----Original Message-----
From: IBM Mainframe Discussion List [mailto:[email protected]] On
Behalf Of Paul Gilmartin
Sent: Tuesday, July 17, 2012 6:06 PM
To: [email protected]
Subject: Re: Unsetting a JCL symbol.

On Tue, 17 Jul 2012 16:43:32 -0500, Bass, Walter W wrote:

>Try this ...
>
>//***** SAVE CURRENT VALUE OF MYSYM
>// SET SAVESYM=&MYSYM
>//***** SET MYSYM TO A NEW VALUE
>// SET MYSYM='NEWVAL'
>
>...
>//***** RESTORE MYSYM
>// SET MYSYM=&SAVESYM
>
>Probably not the answer you wanted, but it works.
>
Actually, it doesn't work:

        3 //BEFORE   EXEC  PGM=IEFBR14,PARM='&MYSYM.X'
          //*
          //***** SAVE CURRENT VALUE OF MYSYM
        4 // SET SAVESYM=&MYSYM
          //***** SET MYSYM TO A NEW VALUE
        5 // SET MYSYM='NEWVAL'
        6 //DURING   EXEC  PGM=IEFBR14,PARM='&MYSYM.X'
          //*
          //***** RESTORE MYSYM
          IEFC653I SUBSTITUTION JCL - PGM=IEFBR14,PARM='NEWVALX'
        7 // SET MYSYM=&SAVESYM
          IEFC653I SUBSTITUTION JCL - MYSYM=&MYSYM
        8 //AFTER    EXEC  PGM=IEFBR14,PARM='&MYSYM.X'
          IEFC653I SUBSTITUTION JCL - PGM=IEFBR14,PARM='&MYSYMX'
        9 //

... notice the difference between lines 3 and 8.

>Another possibility is to take advantage of the fact that symbols that 
>are SET within a PROC automatically revert to their former value after 
>the PROC terminates.
>
That one I believe.  Steve suggested it too.  But in open code, there
seems to be no solution.  Symbols are initially in a Garden of Eden
state (which John G. dislikes).  Once they leave they can never return.

-- gil

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

This e-mail, including attachments, may include confidential and/or
proprietary information, and may be used only by the person or entity to
which it is addressed. If the reader of this e-mail is not the intended
recipient or his or her authorized agent, the reader is hereby notified
that any dissemination, distribution or copying of this e-mail is
prohibited. If you have received this e-mail in error, please notify the
sender by replying to this message and delete this e-mail immediately.

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

The information contained in this e-mail may contain confidential and/or
privileged information and is intended for the sole use of the intended
recipient. If you are not the intended recipient, you are hereby
notified that any unauthorized use, disclosure, distribution or copying
of this communication is strictly prohibited and that you will be held
responsible for any such unauthorized activity, including liability for
any resulting damages. As appropriate, such incident(s) may also be
reported to law enforcement. If you received this e-mail in error,
please reply to sender and destroy or delete the message and any
attachments. Thank you.

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

This e-mail, including attachments, may include confidential and/or
proprietary information, and may be used only by the person or entity
to which it is addressed. If the reader of this e-mail is not the intended
recipient or his or her authorized agent, the reader is hereby notified
that any dissemination, distribution or copying of this e-mail is
prohibited. If you have received this e-mail in error, please notify the
sender by replying to this message and delete this e-mail immediately.

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

Reply via email to