The Question is:
It there a way of invoking a routine like the sylogin routine to run when a
batch program exits? We are trying to monitor the performance of batch jobs.
Throught the sylogin routine I can capture the environment data of when the
jobs starts, but current
ly without modifying all of my programs I do not have an easy way of capturing
the environment data of when the job finishes. Any thoughts?
The Answer is :
There is no central logout script mechanism available within OpenVMS.
Without details of the particular environment data sought, a specific
answer is difficult -- if you are looking for basic process statistics,
these can be configured and then acquired from the system accounting and
security auditing databases.
If your batch procedures consistently use a command such as LOGOUT
to exit, you could (obviously) set up a symbol that invokes a DCL
command procedure or similar.
The LOGINOUT (LGI) callout routines can be used to trap phases of batch
jobs within the context of LOGINOUT during each job step activation or
final log out (LGI$ICR_JOBSTEP and LGI$ICR_LOGOUT, respectively). This
approach assumes, of course, that the LOGINOUT image is invoked.
An example of how to write LGI callout code can be found in the OpenVMS
Utilities Routines Manual.
If you are not using the LOGOUT command, it is still possible to enforce
a logout script on BATCH jobs by explicitly executing the batch
procedure(s) from within the site-specific SYLOGIN procedure. Some
sample DCL is attached below.
Kernel-mode process rundown handlers do exist, but these handlers are
neither particularly easy nor particularly suited for this requirement,
and these process rundown handlers are not documented for use.
Existing discussions of the f$getqui lexical include the following
topics: (813), (1240), (2159), (3951), (4546), (4568), (4903), (5188)
(5471), (5567), (5651), (5793), (5982), (6315), (6877), etc.
$ SET NOVERIFY
$! Execute from SYLOGIN.COM to allow control of logout from a batch job
$! $ IF F$MODE().EQS."BATCH" THEN $ @dev:[dir]EXECUTE_BATCH_JOB
$ entry = F$GETQUI("DISPLAY_JOB","ENTRY_NUMBER",,"THIS_JOB")
$ p1 = F$GETQUI("DISPLAY_ENTRY","PARAMETER_1",entry,"")
$ p2 = F$GETQUI("DISPLAY_ENTRY","PARAMETER_2",entry,"")
$ p3 = F$GETQUI("DISPLAY_ENTRY","PARAMETER_3",entry,"")
$ p4 = F$GETQUI("DISPLAY_ENTRY","PARAMETER_4",entry,"")
$ p5 = F$GETQUI("DISPLAY_ENTRY","PARAMETER_5",entry,"")
$ p6 = F$GETQUI("DISPLAY_ENTRY","PARAMETER_6",entry,"")
$ p7 = F$GETQUI("DISPLAY_ENTRY","PARAMETER_7",entry,"")
$ p8 = F$GETQUI("DISPLAY_ENTRY","PARAMETER_8",entry,"WILDCARD")
$ proc = F$GETQUI("DISPLAY_FILE","FILE_SPECIFICATION",,)
$ IF proc .EQS. "" THEN GOTO no_more_files
$ SET VERIFY
$ @'proc' "''p1'" "''p2'" "''p3'" "''p4'" "''p5'" "''p6'" "''p7'" "''p8'"
$ SET NOVERIFY
$ GOTO next_file
$! Place LOGOUT script here
$ STOP/ID=0 ! Need to STOP the process to prevent the system from
$ ! executing the batch job via the normal mechanism
$ ! Note the normal logout message will not be written
$ ! SHOW PROCESS/ACCOUNT is a possible replacement