Previous Topic

Next Topic

Book Contents

Book Index

Force a Control-M Job and Pass a Variable to It

The example in Figure 108 demonstrates how a Control-M job is forced and information is passed to the job using Global AutoEdit variables.

Figure 108 Example of Forcing a Control-M Job and Passing a Variable to It

ON MESSAGE  = $HASP050

   JNAME          JTYPE         SMFID        SYSTEM

   ROUTE          DESC          CONSOLEID    CONSOLE

   APPEARED       TIMES IN      MINUTES                        And/Or/Not

OWNER IOAADMIN GROUP                         MODE PROD    RUNTSEC

THRESHOLD

DESCRIPTION FORCE A CONTROL-M JOB WHILE PASSING IT A VARIABLE

DESCRIPTION THE VARIABLE IS ACCESSED BY CONTROL-M BY USING THE

DESCRIPTION %%LIBSYM AND %%MEMSYM CONTROL-M AutoEdit STATEMENTS

===========================================================================

/* GET INFORMATION TO BE PASSED TO THE JOB

DO SET      = %%MYPARM = %%$SMFID                                 GLOBAL  Y

/* WRITE THE CONTENTS OF THE VARIABLE TO A MEMBER FOR LATER ACCESS BY

/* CONTROL-M. WAIT UNTIL MESSAGE CTO163I APPEARS

DO COMMAND  = F %%$CONTROLO,WRITEGLOBAL

   WAIT        CONSOLEID    CONSOLE          SYSTEM

   WAITMODE   Y             WAITRESP Y            TIMEOUT 0300 0001

   RESPMSG CTO163I

/* IF CTO163I APPEARS IN THE SPECIFIED TIME FRAME (5 MINUTES) FORCE A JOB

/* THE VARIABLE CAN BE ACCESSED BY CONTROL-M.

IF       %%$MSGID EQ CTO163I

DO FORCEJOB = TABLE   JES2JOBS JOB SYSJES1   UFLOW N    DATE ODAT

              LIBRARY CTM.SCHEDULE

ENDIF

Explanation

DO SET=%%MYPARM=%%$SMFID                        GLOBAL Y

This statement stores the SMFID of the CPU that issued this message in the %%MYPARM user variable. A value of Y (Yes) in the GLOBAL field indicates that this variable is stored as a Control-O Global variable.

DO COMMAND=F %%$CONTROLO,WRITEGLOBAL

 WAIT        CONSOLEID    CONSOLE          SYSTEM

 WAITMODE   Y WAITRESP Y TIMEOUT 0300 0001

 RESPMSG CTO163I

This operator command must be issued to ensure that the new Global variable is written in the Global member and is therefore accessible by Control-M.

Y is specified in the WAITMODE field to indicate that execution of the rule should be postponed for the number of seconds specified in the TIMEOUT field or until the message specified in the RESPMSG field is detected.

The CTO163I message indicates a successful execution of a WRITEGLOBAL command. When this message is detected, the Control-M job is able to access the Global variable defined in this rule (%%MYPARM).

IF       %%$MSGID EQ CTO163I

DO FORCEJOB=TABLE   JES2JOBS   JOB SYSJES1   UFLOW N    DATE ODAT

 LIBRARY CTM.SCHEDULE

The %%$MSGID system variable contains the ID of the message most recently detected. If the ID stored in this variable indicates that the above command was successfully performed, the Control-M job is forced.

Note: Control-M accesses the %%MYPARM Global variable by specifying the dsname and member of the Control-O Global variables data set through %%LIBSYM and %%MEMSYM Control-M AutoEdit statements in the JCL of the job specified in the DO FORCEJOB statement (SYSJES1).

Parent Topic

Working With Control-O Rules