beautypg.com

Sample cobol application, Example 5-2, Tal source of the meas^bump procedure – HP NonStop G-Series User Manual

Page 105

background image

Defining Custom Counters

Measure User’s Guide 520560-003

5 -9

Sample COBOL Application

Sample COBOL Application

To modify a COBOL program to establish a programmatic interface to the Measure
subsystem and update user-defined counters:

1. Create a TAL procedure named MEAS^BUMP by compiling the sample TAL

routine shown in

Example 5-2

.

2. Place the object in a user-named file (

measlib

).

The sample COBOL program in

Example 5-3

on page 5-10:

1. Adds a ?SEARCH directive to identify the location of the

measlib

file

2. Adds the working storage Measure literals (WS-MEASURE-LITS) to the

WORKING STORAGE SECTION of the program

3. Adds a working-storage entry (WS-

id

-NAME) to uniquely identify each

user-defined counter

4. For every ADD-type counter, adds an extra working-storage entry

(WS-

id

-COUNT) to hold the value to be added to the counter

The counters are ready to use after they are defined.

Example 5-2. TAL Source of the MEAS^BUMP Procedure

?SYMBOLS,INSPECT
?NOMAP, NOLMAP, NOCODE

INT ERROR :=0;

?SOURCE $SYSTEM.SYSTEM.EXTDECS0 (MEASCOUNTERBUMPINIT,
MEASCOUNTERBUMP)
INT PROC MEAS^BUMP (name,bumptype,addvalue,index)
EXTENSIBLE;
STRING .NAME;
INT bumptype, addvalue, index;
BEGIN
INT .INAME := @Name '>>' 1;
INT OFFSET;

IF NOT $PARAM(bumptype) THEN
bumptype := 0;

IF NOT $PARAM(addvalue) THEN
addvalue := 0;

IF NOT $PARAM(index) THEN
index := 0;

ERROR := MEASCOUNTERBUMPINIT (iname, offset);
If error <> 0 then return error;
RETURN MEASCOUNTERBUMP (offset,bumptype,addvalue,index);

END;