OK. If this is a scan and not run-time, you should be able to identify all
types of variables: System variables (returned by MVSVAR(SYMDEF,xxx)), JCL
SET commands, and PROC variables. This is the general case. If you only
look at your private case that involves only JCL SET variables, you should
look at a code like the one below (I have a complete solution but it is
part of our IronSphere Breaking Lines product that performs code review).
Some things to consider:


   - It will only work if the DD and DSNAME/PATH/DSN are on the same line.
   I usually make a DD a single line to solve this.
   - Substitution is more complex since you have several END options and to
   ignore temporary datasets such as those starting with '&&'
   - The reason I am using an index (SYMINDX) is to be able to access the
   variables directly and sequentially.

Best,
ITschak

JCLSUBS:
   Parse Arg $Lib $Mem
   $Dsn = $lib'('$Mem')'

   If (Sysdsn($Lib) /= OK) Then Do
      Say 'MEMBER OR DATASET DOES NOT EXIST'
      Exit 8
      End

   "Alloc f(JCLMEMBR) DA('"$Lib"("$Mem")') SHR"
   "ExecIO * DiskR JCLMEMBR (Stem JCL. Fini"

   SymIndx = 0

   Do i = 1 to JCL.0
      Jcl.i  = Substr(Jcl.i,1,71)
      Parse Var JCL.i xName xTYpe XRest

      If (xType = 'SET') Then Do
         Interpret xrest
         Parse Var xRest xVar '=' xValue
         xVar   = Strip(xVar)
         SymIndx = SymIndx + 1
         Sym.SymIndx = xVar
         Sym.xVar = xValue
         SAy xVar '=' xValue
         End

      End

   Do i = 1 to JCL.0
      Parse Var JCL.i xName xTYpe XRest

      If (xType /= 'DD') Then Do
         Iterate
         End

      xPos1 = WordPos('DSN=',xRest)
      xPos2 = WordPos('DSNAME=',xRest)
      xPos3 = WordPos('PATH=',xRest)

      If (xPos1 > 0) Then Do
         Parse Var xRest . 'SN=' xDsn ' ' .
         End

      If (xPos2 > 0) Then Do
         Parse Var xRest . 'SNName=' xDsn ' ' .
         End

      If (xPos3 > 0) Then Do
         Parse Var xRest . 'ATH=' xDsn ' ' .
         End

      xPos = Pos(',',xDsn)

      If (xPos > 0) Then Do
         Parse Var xDsn xdsn ',' .
         End

      Call Substitute
      End

   Return

*| **Itschak Mugzach | Director | SecuriTeam Software **|** IronSphere
Platform* *|* *Information Security Continuous Monitoring for Z/OS, zLinux
and IBM I **|  *

*|* *Email**: [email protected] **|* *Mob**: +972 522 986404 **|*
*Skype**: ItschakMugzach **|* *Web**: www.Securiteam.co.il  **|*





On Fri, Aug 4, 2023 at 12:58 AM David Spiegel <
[email protected]> wrote:

> Hi R'Itschak AMVS"H,
> Yes, it is a scan.
> The purpose of the scan is to ensure that my jobs which implement a
> Middleware upgrade have a good chance of succeeding.
> These jobs are SUBMITd at 02:00 when the adrenaline is flowing, Teams
> messages are non-stop and the stress level is through the roof.
> The last thing I want to do is start looking for missing Datasets and/or
> RENAME conflicts.
>
> Shabbat Shalom
>
> Regards,
> David
> ________________________________
> From: IBM Mainframe Discussion List <[email protected]> on behalf
> of ITschak Mugzach <[email protected]>
> Sent: Thursday, August 3, 2023 3:54:18 PM
> To: [email protected] <[email protected]>
> Subject: Re: Accessing JCL SETs in Rexx
>
> David,
>
> So this is not a run time issue, but a scan of a jcl before submition?
>
> ITschak Mugzach
> *|** IronSphere Platform* *|* *Information Security Continuous Monitoring
> for z/OS, x/Linux & IBM I **| z/VM coming soon  *
>
>
>
>
> On Thu, Aug 3, 2023 at 10:21 PM David Spiegel <
> [email protected]> wrote:
>
> > Hi Gil,
> > My intention is to read a Job and make sure that all datasets are
> > available, but, the dsnames contain SET variables.
> >
> > Regards,
> > David
> >
> > Sent from my Bell Samsung device over Canada’s largest network.
> > ________________________________
> > From: IBM Mainframe Discussion List <[email protected]> on behalf
> > of Paul Gilmartin <[email protected]>
> > Sent: Thursday, August 3, 2023 1:58:20 PM
> > To: [email protected] <[email protected]>
> > Subject: Re: Accessing JCL SETs in Rexx
> >
> > On Thu, 3 Aug 2023 17:11:08 +0000, David Spiegel wrote:
> > >
> > >Does anyone know how to access the JCL SET variables from Rexx.
> > >
> > What are your constraints?  I could envision invoking your REXX with
> > BPXWUNIX or BPXBATCH and passing your symbols in
> >     //STDPARM  DD  *,SYMBOLS=JCLONLY
> >         ...
> >
> > --
> > gil
> >
> > ----------------------------------------------------------------------
> > For IBM-MAIN subscribe / signoff / archive access instructions,
> > send email to [email protected] with the message: INFO IBM-MAIN
> >
> > ----------------------------------------------------------------------
> > For IBM-MAIN subscribe / signoff / archive access instructions,
> > send email to [email protected] with the message: INFO IBM-MAIN
> >
>
> ----------------------------------------------------------------------
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to [email protected] with the message: INFO IBM-MAIN
>
> ----------------------------------------------------------------------
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to [email protected] with the message: INFO IBM-MAIN
>

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

Reply via email to