How to execute a command immediately before or after running a Control-M job, say for example the batch script on Windows requires a network drive to be mapped? |
The Control-M system autoedit variables %%PRECMD and %%POSTCMD may be used to accomplish this. Here is the description of these system variables: POSTCMD: Specifies a command to run immediately after running the job defined by MEMNAME. The return code is ignored.Note: Not relevant for z/OS jobs. Relevant only for Control-M/Server version 6.0.01 or later, or (without SYSOUT) for any job submitted by Control-M/Agent for Microsoft Windows 2000 version 6.0.01 or later. This variable is not used with SMART Tables. PRECMD: Specifies a command to run immediately before running the job defined by MEMNAME. The return code is ignored. Note: Not relevant for z/OS jobs. Relevant only for Control-M/Server version 6.0.01 or later, or (without SYSOUT) for any job submitted by Control-M/Agent for Microsoft Windows 2000 version 6.0.01 or later. This variable is not used with SMART Tables. For Control-M/Enterprise Manager V7.0.00 and earlier: you must define them in the "%%Set" tab of the job definition, in order to use these system variables. For example: Variable Name Variable Value %%PRECMD net use Z: \\host1\C$ %%POSTCMD net use Z: /delete For Control-M/Enterprise Manager V8.0.00 and later: you can use the Pre-execution command and Post-execution command fields in the job definition form as below screenshot Note: a. Control-M Module jobs cannot be defined with PRE/POST cmd b. the execution code of PRE/POST command will not affect the actual job execution completion code c. PRE/POST command execution is independent of the actual job execution
|