Handling an Event with a Script - zOS
Handling an Event With a Script in z/OS
In this example, a demand-driven UEM Server installed on a Windows machine will watch for the creation of a file called uemtest.dat. Since no path is specified, it will look for this file in the user's UEM Server working directory.
A relative inactive date/time is used to instruct the UEM Server to monitor the event for 10 minutes. If the file is detected and completes within that time, the event occurrence will be set to the triggered state. The script statements contained within the MYSCRIPT DD statement then will be written to a temporary script file and executed by UEM Server.
The value specified by the -handler_opts option is appended to the command line constructed by UEM in order to execute the temporary script file. This will cause the values parm1, parm2, and parm3 to be passed to the script. Further, any output generated by the script will be written to a file in the UEM Server working directory, uemtest.log.
If the file is detected, but does not complete before the inactive time elapses, the event occurrence will be set to a rejected state. Since no event handler information is provided for a rejected occurrence, no further action will be taken by the UEM Server.
If the UEM Server does not detect the presence of uemtest.dat before the inactive time elapses, the event will be set to an expired state. Again, because no handler information is given for this state, no further action will be taken by the UEM Server.
//jobname JOB CLASS=A,MSGCLASS=X,NOTIFY=&SYSUID //STEP1 EXEC UEMPRC //MYSCRIPT DD * @echo off :: Program variables set parmCtr=1 :: Loop through parameter list :: **** Start of loop **** :BeginLoop if ""%1""=="""" goto EndLoop :DisplayParm echo Parm %parmCtr%: %1 :: Shift the next parm shift set /a parmCtr+=1 :: Go back to the top goto BeginLoop :: **** End of loop **** :EndLoop //SYSIN DD * -event_type file -filespec uemtest.dat -inact_date_time +10 -handler_opts "parm1 parm2 parm3 >uemtest.log 2>&1" -host uemhost -userid uemuser -pwd uemusers_password -triggered -script myscript /*
SYSIN Options
The SYSIN options used in this example are:
Option | Description |
---|---|
Type of event to monitor. | |
Name or pattern of the file whose creation should be detected and tracked for completion. | |
Date and time at which the state of the monitored event should be made inactive. | |
Forces the UEM Manager to wait for the completion of the UEM Server. | |
List of one or more hosts upon which a command may run. | |
ID of a remote user account that the UEM Server uses to establish the security context in which event monitoring is performed. | |
Password associated with -userid. | |
Event state that, when encountered, will result in the execution of the associated event handler. | |
Complete path to a local script file or DD statement that contains one or more system commands that should be executed on behalf of the event handler. |