CBL_SRV_SERVICE_FLAGS_GET

Enables a program running within a COBOL container as part of a service to determine the service's execution characteristics.

Syntax:

call CBL_SRV_SERVICE_FLAGS_GET using by reference service-flags
                                        returning status-code

Parameters

service-flags
Call prototype (see Key): cblt-x4-comp5
Picture: pic x(4) comp-5.
status-code
See Library Routines - Key.

On Entry:

None

On Exit:

service-flags
Service control flags:
Bit 0
Value Meaning
0 None
1 Commit transactional resources during successful service termination
Bit 1
Value Meaning
0 None
1 Rollback transactional resources during successful service termination.
Bits 0 and 1 are treated as a bit pair and only relate to container-managed services. If neither bit is set, at service termination the run-time system will commit transactional resources if the service completes successfully, otherwise it will rollback transactional resources. The API will never return with both bits 0 and 1 set.
Bits 2-30
Reserved for future use
Bit 31
Value Meaning
0 The service has not dirtied the COBOL container.
1 The service has dirtied the COBOL container and will result in the SEP being terminated following service termination.
status-code
0 Success
1015 Not running within the COBOL container

Example

copy "cblproto.cpy".

...

78 78-SERVICE-FLAG-COMMIT            value h"00000001".
78 78-SERVICE-FLAG-ROLLBACK          value h"00000002".
78 78-SERVICE-FLAG-DIRTY-CONTAINER   value h"80000000".

01 service-flags   pic x(4) comp-5.

...

call "CBL_SRV_SERVICE_FLAGS_GET" using 
                                 by reference service-flags

if return-code = 0
    display "Running as a service" upon console

    if service-flags b-and
       78-SERVICE-FLAG-COMMIT not = 0
        display "Service will commit"
    end-if

    if service-flags b-and
       78-SERVICE-FLAG-ROLLBACK not = 0
        display "Service will rollback"
    end-if

    if service-flags b-and
       78-SERVICE-FLAG-DIRTY-CONTAINER not = 0
        display "Service will dirty the container"
    end-if
else
    display "Not running as a service" upon console
end-if

...