Program mainline example
Use this example to help set up recovery for the latch manager.
SETFRR /* Establish recovery routine */
latch_token=Zeroes; /* Clear latch token */
updating_resource=OFF; /* Clear resource update flag */
init_complete=ON; /* Set initialization flag */
CALL ISGLOBT(latch_set_token, /* Obtain the latch associated */
latch_number, /* with resource to be updated */
requestor_ID,
ISGLOBT_SYNC, /* Indicates the resource should */
ISGLOBT_EXCLUSIVE, /* wait for the resource to be */
ECB_address, /* available
latch_token, /* see note 1 below */
work_area, /* see note 2 below */
return_code);
updating_resource=ON; /* Indicate that the program is */
. /* about to update the resource */
< Update resource > /* Code for resource update */
.
updating_resource=OFF; /* Resource update complete */
CALL ISGLREL(latch_set_token, /* Release the latch */
latch_token,
ISGLREL_UNCOND, /* You want ISGLREL to abend */
work_area, /* if the latch was not owned */
return_code);
Note:
- An ABEND can occur prior to the service returning, consequently the latch token might be set by the service even when the latch is not obtained.
- Zero is the only possible return code for the ISGLOBT_SYNCH option, so you know that you definitely hold the latch.