Operating Systems


Mainline Processing

In Figure 4 we select our target paragraph to be executed based on our earlier detected execution environment (see Figure 3). The code in each of these paragraphs must conform to the CICS/COBOL restrictions irrespective of the actual execution environment. If an unexpected environment has been detected, then a non-zero return code is set and the COBOL/VSE program terminates. After completion, some simple return-code checking is performed. 

For demonstration purposes, our case study will perform termination based on our execution environment. 

In most production situations, a single GOBACK can be used for termination in both the batch and CICS environments. This can also be useful if the environment-independent routine is to be called from other modules. However, if desired, the environment-specific termination method in Figure 4 can be used. 

Next, we will examine the batch-specific paragraph, 0200-batch, in Figure 5. For our batch-specific paragraph, as a simple demonstration, we will call the LE random number generator callable service dynamically to return a random number between 0 and 1, exclusively. This could also be performed as a static call, if desired.

We then convert this random number into a value between one and 100. This number is then displayed in the program output. If the service fails for any reason, the message number associated with the failure is displayed in the program output. 

For the second and final stage of our batch execution process example, we perform a static call to the callable service CEE5TSTG as a simple demonstration that will test our access to the address contained in field “test-addr.” As this field is zero, we’re effectively testing our COBOL program’s access to low memory (basically, location zero).Once the service returns, we review the feedback code. Based on the value provided, a message is sent to the COBOL program’s output file to indicate the result of the service. Much of the code from Figure 5 has been taken from the supplied sample IGZTSTG.C in PRD2.SCEEBASE. Paragraph 022-batch is then completed and control returns to the statement following the paragraph call.

Next, we will examine the CICS-specific paragraph, 0200-CICS, in Figure 6. First, we address the current CICS application EIB to ensure that any subsequent CICS calls we may execute that require a valid EIB will complete as expected. Normally, we would be passed the EIB as a parameter, as the CICS translator adds this to our source code; this step is simply to accommodate any possible calls that may not adhere to this standard practice. 

5 Pages