CBL_SRV_SERVICE_FLAGS_SET

Enables a program running within a COBOL container as part of a service to set one or more the service's execution characteristics.

Syntax:

call CBL_SRV_SERVICE_FLAGS_SET using by value service-flags-mask
                                     by value service-flags
                                    returning status-code

Parameters

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

On Entry:

service-flags-mask
Mask that specifies the bit flags to be changed:
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.
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.

Attempting to set both bits 0 and 1 will be treated as an error; attempting to set either bit 0 or bit 1 by an application-managed service will also be treated as an error.

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.

On Exit:

status-code
0 Success
1009 Invalid parameter passed to the API
1015 Not running within the COBOL container
1016 Can only set commit/rollback flags when container managed

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.
01 service-flags-mask   pic x(4) comp-5.

...

*>
*> Clear the "rollback" flag.
*> Set the "commit" and "dirty container" flags
*>

compute service-flags-mask = 78-SERVICE-FLAG-COMMIT b-or
                             78-SERVICE-FLAG-ROLLBACK b-or
                             78-SERVICE-FLAG-DIRTY-CONTAINER
compute service-flags = 78-SERVICE-FLAG-COMMIT b-or
                        78-SERVICE-FLAG-DIRTY-CONTAINER

call "CBL_SRV_SERVICE_FLAGS_SET" using 
                                 by value service-flags-mask
                                 by value service-flags

...