Mainframe Utility: SYNCVARS

Return to Mainframe Utilities Page

Module


/* REXX ***************************************************************/
/* UTILITY: SYNCVARS                                                  */
/* AUTHOR: DAVID LEIGH                                                */
/* FUNCTION: THIS UTILITY TAKES INPUT OF A QUEUE OF VARIABLES AND     */
/*           SETS THAT VARIABLE'S VALUE IN ALL OTHER ISPF PROF. POOLS.*/
/**********************************************************************/
/**********************************************************************/
/* INITIALIZATION                                                     */
/**********************************************************************/
ARG EXCLUDE
ADDRESS ISPEXEC
NUMVARS = QUEUED()

IF NUMVARS = 0 THEN
    DO
        ZEDLMSG = 'ENTER NAME OF VARIABLE TO',
                  '"SYNC" WITHIN ALL YOUR PROFILES',
                  'OR DATASET NAME CONTAINING 1 VARIABLE NAME',
                  'PER RECORD'
        "SETMSG MSG(UTLZ000W)"
        "ADDPOP COLUMN(4) ROW(3)"
        DO FOREVER
            "DISPLAY PANEL(SYNCVARS)"
            SELECT
                WHEN RC = 0 & PANELVAR > '' &PANELDSN > '' THEN DO
                    ZEDLMSG = 'A VARIABLE AND A DATASET CANNOT BOTH',
                              'BE SPECIFIED'
                    "SETMSG MSG(UTLZ001W)"
                    ITERATE
                END
                WHEN RC = 0 & PANELVAR > '' THEN DO
                    NUMVARS = 1
                    QUEUE PANELVAR
                    LEAVE
                END
                WHEN RC = 0 & PANELDSN > '' THEN DO
                    IF SYSDSN("'"PANELDSN"'") ¬= OK THEN
                        DO
                            Y = SYSDSN("'"PANELDSN"'")
                            ZEDLMSG = '"'PANELDSN'" PROBLEM: 'Y
                            "SETMSG MSG(UTLZ001W)"
                            ITERATE
                        END
                    ADDRESS TSO
                    DUMMY = OUTTRAP(NULL)
                    "FREE DD(TEMPDD)"
                    "ALLOCATE DD(TEMPDD) DSN('"PANELDSN"') SHR"
                    DROP NULL.
                    "EXECIO * DISKR TEMPDD (FINIS"
                    NUMVARS = QUEUED()
                    ADDRESS ISPEXEC
                    LEAVE
                END
                WHEN RC = 8 THEN DO
                    ZEDLMSG = '"END" SELECTED - NO SYNCVARS',
                              'PROCESSING PERFORMED'
                    "SETMSG MSG(UTLZ001W)"
                    "REMPOP"
                    EXIT
                END
                WHEN RC = 0 THEN NOP
                OTHERWISE DO
                    ZEDLMSG = 'RC FROM ISPF DISPLAY OF PANEL',
                              '"SYNCVARS" WAS' RC
                    "SETMSG MSG(UTLZ001W)"
                    "REMPOP"
                    EXIT 12
                END
            END
        END
        "REMPOP"
    END

"TBCREATE TEMPPASS NOWRITE REPLACE KEYS() NAMES(VAR VARVAL)"
NUMADDED = 0

DO I = 1 TO NUMVARS
    PULL VAR
    VAR = STRIP(VAR,B,' ')
    "VGET" VAR "PROFILE"
    IF RC = 0 THEN
        DO
            INTERPRET "VARVAL = VALUE(VAR)"
            "TBADD TEMPPASS"
            NUMADDED = NUMADDED + 1
        END
END


IF NUMADDED = 0 THEN
    DO
        ZEDLMSG = 'NONE OF THE VARIABLES SPECIFIED EXIST IN THIS',
                  'PROFILE....NO PROCESSING PERFORMED'
        "SETMSG MSG(UTLZ001W)"
        EXIT
    END

/**********************************************************************/
/* POINT TO THE DATASET TO BE PROCESSED AND DO A PRIMING MEMBER READ  */
/**********************************************************************/
"ADDPOP COLUMN(20) ROW(10)"
"LMINIT DATASET('"SYSVAR(SYSUID)".ISPF.ISPPROF') DATAID(DID) ENQ(SHRW)"
"VGET ZAPPLID"

"LMOPEN DATAID("DID")"
"LMMLIST DATAID("DID") MEMBER(MBR) OPTION(LIST)"

/**********************************************************************/
/* LOOP THROUGH THE PROFILE MEMBERS AND CALL SYNCVAR2 TO DO THE UPDATE*/
/**********************************************************************/
DO WHILE RC = 0
    MBR = STRIP(MBR)
    IF POS('PROF',MBR) = LENGTH(MBR) - 3 THEN
        DO
            APPL = SUBSTR(MBR,1,POS('PROF',MBR)-1)
            IF APPL ¬= 'ISPS' &,
               POS(APPL,EXCLUDE) = 0 &,
               APPL ¬= ZAPPLID THEN
                DO
                    APPL = "NEWAPPL("APPL")"
                    "CONTROL DISPLAY LOCK"
                    "DISPLAY PANEL(SYNCVAR2)"
                    "SELECT CMD(%SYNCVAR2)" APPL
                END
        END
    "LMMLIST DATAID("DID") MEMBER(MBR) OPTION(LIST)"
END

/**********************************************************************/
/* CLEAN UP AND LET THE USER KNOW WHERE THE OUTPUT IS.                */
/**********************************************************************/
"LMMLIST DATAID("DID") MEMBER(MBR) OPTION(FREE)"
"LMCLOSE DATAID("DID")"
"LMFREE DATAID("DID")"
"REMPOP"
            


Documentation


 SYNCVARS is a utility which takes the value of a specific profile
 variable in ISPF profile currently being used, and propagates its value
 in all your ISPF profiles for you.  SYNCVARS can also take input of a
 file which contains a list of variable names (one per record in the
 file) or can be called from another REXX exec which has put a list of
 variable names into the data stack with the QUEUE or PUSH facility.

 A common use for such a utility is to syncronize certain PF key
 settings in every profile.  Type the following on the command
 (or option) line:

 COMMAND ===> tso syncvars

 At which point the following screen would come up:

 +------------------------------------------------------------------+
 | ---- Syncronize ISPF Profile Pool Variables Across Profiles ---- |
 | COMMAND ==>                                                      |
 |                                                                  |
 | Variable Name ==>                                                |
 |                                                                  |
 |           OR                                                     |
 |                                                                  |
 | Dataset Name  ==>                                                |
 |                                                                  |
 |           END to quit or ENTER to process your request           |
 +------------------------------------------------------------------+

 On this screen, type the name of the variable which you want to
 syncronize across environments and press ENTER.

 FOR EXAMPLE: If you have PF24 set to some command and you want PF24
 to look the same in all your ISPF profiles, you would type the
 following on the command (or option) line:

 COMMAND ===> tso syncvars

 At which point the following screen would come up.  Enter the data
 "ZPF24" as the variable name (the letter "Z" is needed at the
 beginning of the PFkey).

 +------------------------------------------------------------------+
 | ---- Syncronize ISPF Profile Pool Variables Across Profiles ---- |
 | COMMAND ==>                                                      |
 |                                                                  |
 | Variable Name ==> zpf24                                          |
 |                                                                  |
 |           OR                                                     |
 |                                                                  |
 | Dataset Name  ==>                                                |
 |                                                                  |
 |           END to quit or ENTER to process your request           |
 +------------------------------------------------------------------+

 Press ENTER.  You will receive messages indicating your various
 profiles are being synchronized.

 If you have many variable to syncronize, put them in a dataset with one
 variable name per line like:

 PJOBSUFF
 UTILNAME
 BINNM
 CCNTR
 QBRN1

 Then, on the screen, you can use the dataset name field instead and it
 will use your dataset as input and syncronize all the variables in the
 dataset.
            


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.