This document covers the following topics:
For End-of-Job checking user exits, the common exit parameter list
NOPXPL-A must be used.
The parameter P-CALL-PLACE will contain EJC
for end-of-job
checking or EJA
for end-of-job action.
The field P-JOB-NUMBER (N5) should no longer be used. It is too short for some operating systems. Use the field P-JOB-ID (A10) instead.
To create or edit the user exit for End-of-Job checking or end-of-job action
Type E
in the line command field of the
associated event in the End-of-Job
Checking and Actions: Columns EOJ Checking
Page. Press
Enter.
The Entire Operations Editor screen appears. If a user exit has already been defined, it appears on the screen.
Note:
The edit option - E
line command - is
available only at the event level, and only if the event is an R-type.
You can modify the existing user exit or create a new one using Editor commands and PF keys.
A user check routine must be a Natural subprogram. The subprogram returns a code zero to signal job ok status. Any other code signals job not ok.
An End-of-Job checking user exit is shown in the example below. This
routine summarizes the contents of a numeric field in the SYSOUT and compares
it with a given value. If both are equal, the event is treated as
ok
, otherwise as not ok
.
For a full description of the Editor, see the Software AG Editor Documentation.
DEFINE DATA PARAMETER USING NOPXPL-A LOCAL 1 READ-SPOOL VIEW OF READ-SPOOL /* AN ENTIRE SYSTEM SERVER VIEW 2 RECORD 2 REDEFINE RECORD 3 RECORD-HEADER (A05) * 1 #NF (I02) CONST <10> /* MAX. NUMBER FOR SEPARATION 1 #SUM (N08) INIT <0> 1 #SUM-EXPECTED (N08) CONST <2000> 1 #FIELD (A10/1:#NF) 1 #USERID (A08) 1 #DBENV (A10) 1 #NETWORK-VERSION (A10) 1 #LOG-STATUS (N04) 1 #LOG-MESSAGE (A60) 1 #LOG-TARGET (A03) CONST <’NOP’> 1 #USE-NAT-MSG-CACHE (L) CONST <FALSE> END-DEFINE
* ------------------------------------------------- * This EOJ User Exit will read the Job SYSOUT (data set 2) * and will summarize a defined field. * If the sum is equal to a given value, this routine returns * an 'OK' (P-RC = 0), otherwise 'NOT OK'. * * A log record will be written to document the result. * RESET #SUM RS. FIND READ-SPOOL WITH NODE = P-EXECUTION-NODE AND JOB-NUMBER = P-JOB-NUMBER AND TYPE = 'SO' AND DATA-SET = 2 AND RECORD-NUMBER >= 1 ACCEPT IF RS.RECORD-HEADER = 'REC01' /* interesting only SEPARATE RS.RECORD LEFT JUSTIFIED INTO #FIELD(*) ADD VAL(#FIELD(3)) TO #SUM END-FIND * IF #SUM = #SUM-EXPECTED RESET P-RC MOVE 'Sum check is ok' TO #LOG-MESSAGE ELSE MOVE 1 TO P-RC COMPRESS 'Sum:' #SUM 'Expected:' #SUM-EXPECTED INTO #LOG-MESSAGE END-IF #USERID := *USER MOVE 9999 TO #LOG-STATUS CALLNAT 'NOPULW93N' /* WRITE LOG RECORD #LOG-STATUS #LOG-MESSAGE #DBENV P-OWNER P-NETWORK #NETWORK-VERSION P-RUN P-JOB P-JOB-ID #LOG-TARGET # USE-NAT-MSG-CACHE END