OpenTP1 Version 7 Programming Reference COBOL Language

[Contents][Index][Back][Next]

CBLDCLCK('GET ') - Enable locking of a resource

Format

PROCEDURE DIVISION specification

CALL  'CBLDCLCK'  USING  unique-name-1  unique-name-2

DATA DIVISION specification

01  unique-name-1.
    02  data-name-A    PIC X(8) VALUE 'GET     '.
    02  data-name-B    PIC X(5).
    02  FILLER        PIC X(3).
    02  data-name-Z    PIC S9(9) COMP VALUE ZERO.
01  unique-name-2.
    02  data-name-C    PIC X(16).
    02  data-name-D    PIC X(2).
    02  FILLER        PIC X(6).
    02  data-name-E    PIC X(6).
    02  FILLER        PIC X(2).
    02  data-name-F    PIC X(6).
    02  FILLER        PIC X(2).
    02  data-name-G    PIC X(7) VALUE 'MIGRATE'.
    02  FILLER        PIC X(1).

Description

CBLDCLCK('GET ') specifies lock for resources to be used by UAPs. The resource indicated by data-name-C is handled under lock. Lock is managed in global transactions which are managed by the OpenTP1 transaction manager.

The lock specified here is released by COBOL-UAP creation program (releasing all resources from lock or specifying a resource name and releasing the resource from lock). The lock is also released when the synchronization point of the global transaction that called CBLDCLCK('GET ') is acquired.

Data areas whose values are set in the UAP

data-name-A

Specify VALUE 'GET[Figure]' for the request code indicating lock for resources.

data-name-Z

Specify 0.

data-name-C

Specify the name of the resource for which lock is to be specified. The name can be specified with up to 16-byte alphanumeric characters. The OpenTP1 lock service manages the lock on the basis of the specified resource name.

The lock service does not check the contents of the character string. Specify a logically correct name. If a value other than alphanumeric characters is used to specify the resource name, the deadlock information, the timeout information, and the lckls command might not be displayed normally.

data-name-D

Specify a lock mode with VALUE 'PR' or VALUE 'EX'.

VALUE 'PR': The resource is referenced. Other UAPs are permitted to reference the resource but are not permitted to update it.

VALUE 'EX': The resource is updated. Other UAPs are not permitted to reference or update the resource.

data-name-E

Specify processing if the program competes for the resource with another UAP. (The program returns with an error or the program waits until the resource is released.) The following values are available:

VALUE 'WAIT[Figure]': If the program competes for the resource with another UAP, the program waits until the resource is released.

VALUE 'NOWAIT': If the program competes for the resource with another UAP, the program returns with an error.

data-name-F

Specify whether the lock specified here is test lock or not. The following values are available:

VALUE 'TEST[Figure]': Test lock

VALUE 'NOTEST': Not test lock

When test lock is specified, note that the resource specified for data-name-C is not under lock even if CBLDCLCK('GET ') terminates normally.

data-name-G

Specify VALUE 'MIGRATE'.

Data area to which a value is returned from OpenTP1

data-name-B

A status code of 5 digits is returned.

Status codes

Status code Explanation
00000 Normal termination.
00401 The value specified for the data-name is invalid.
This error also occurs if the request code (data-name-A) is invalid.
00450 Another UAP is using the specified resource.
00452 A deadlock occurred.
00453 The resource could not be acquired because a timeout occurred (the wait time specified in the OpenTP1 lock service definition was exceeded).
00454 The table for lock is insufficient.
00455 CBLDCLCK('GET ') was called from a UAP which was not operating as a transaction.
00457 The OpenTP1 library version does not match the lock service version.