Initiating a database call


The following 2 figures show examples of Assembler and COBOL statements to initiate timing of a user-defined database call for a database identified as B.

A similar call, with the exception that CUEXCNTL must be T, is made at the completion of the user-defined database call. When control returns from CMRCUEX, all registers are restored except for registers 0, 1, and 15. Register 15 contains the return code.

Sample assembler statements to initiate a database call

MVI   CUEXCNTL,C'I' Tell CMRCUEX to start clock
MVI   CUEXRQST,C'D' Collect database stats
MVI   CUEXTYPE,C'B' Identify this database
MVC   CUEXNAME,file name May contain any identifying info
LA    R1,CUEXPARM Pass the parameters to CMRCUEX
L     R15,=V(CMRCUEX) Get CMRCUEX's addr from linkage
editor
BALR  R14,R15 Transfer control to CMRCUEX
-------
CUEXPARM    DS    0F
CUEXCNTL    DS    C I=start clock, T=stop clock, U=user data
CUEXDATA    DS    0CL18 Put user data here when CUEXCNTL=U
*---- Use the following fields when starting or stopping clocks
CUEXRQST    DS    C 4=4GL, D=database
CUEXTYPE    DS    C Identifies 4GL or DB (see restrictions above)
CUEXNAME    DS    CL8 4GL program name or database file name or
other identifying information
DS    CL8 Unused when starting or stopping clocks

To invoke CMRCUEX from a COBOL program, you must call CMRCCUEX rather than CMRCUEX. CMRCCUEX is an interface program that translates the parameter that is passing protocol from the one used by COBOL to the one expected by CMRCUEX. CMRCCUEX then invokes CMRCUEX. The following figure shows an example of the processing.

Sample COBOL statements to initiate a database call

01 CMRCUEX-PARAMETERS.
03  CUEX-INIT-TERM-OR-USER-CALL PIC X.
03  CUEX-USER-DATA PIC X(18).
03  CUEX-TIMING-CTL-FIELDS REDEFINES CUEX-USER-DATA.
05 CUEX-4GL-OR-DB PIC X.
05 CUEX-4GL-OR-DB-ID PIC X. (See restrictions above)
05 CUEX-FILE-OR-PGM-NAME PIC X(8).
05 FILLER PIC X(8).
-----------
MOVE 'I' TO CUEX-INIT-TERM-OR-USER-CALL
MOVE 'D' TO CUEX-4GL-OR-DB
MOVE 'B' TO CUEX-4GL-OR-DB-ID
MOVE file name TO CUEX-FILE-OR-PGM-NAME
CALL 'CMRCCUEX' USING CMRCUEX-PARAMETERS.

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*