What is DFHCOMMAREA? Why is it a Linkage Section Storage Area?

What is DFHCOMMAREA? Why is it a Linkage Section Storage Area?

When the user types Input text Data on the CICS GUI Input Screen – say he presses Option 1 on the MAIN MENU Screen, and hits ENTER, the COBOL Program starts from the top at the PROCEDURE DIVISION, processes the data, and sends the next CICS Output Screen say BOOK MENU Screen, and gets killed(terminated). This is called one Invocation of the COBOL Online Program.

The User stares at the BOOK MENU screen, decides what Input to type, and then after filling in the passenger details on the BOOK MENU Input Screen, hits ENTER. The COBOL Online Program restarts all over again from the PROCEDURE DIVISION, processes the Passenger Details and reserves a ticket, and sends the next CICS Output Screen say CONFIRMATION TICKET Screen, and gets killed. This is the second invocation of the COBOL Online Program.

Every time, the COBOL Program starts from the PROCEDURE DIVISION, receives data from the Input Screen, processes the data, and sends the next output screen, and finally stops running. The Start-Receive Input-Process-Send Output-Stop cycle keeps repeating till you are done with your task. Each time you type data and hit ENTER, you invoke or run the COBOL Program to process your inputs.

Sometimes, you need to save(remember) data between two successive runs, or invocations of the COBOL Online Program. Such data cannot be stored in Working Storage Areas of the COBOL Program. Working Storage Areas are created when the COBOL Program starts, and deleted when the COBOL Program stops. Working Storage Areas are rough-work areas(scratch-pad) of the COBOL Program, that live only as long as the COBOL Program runs.

The requirement however, is to store(save) data across multiple invocations(runs) of the COBOL Online Program. When you want to store(save) data which is globally accessible across several runs a COBOL Program, you use Linkage Section Storage Areas
.
Given below is a simple picture that depicts how Linkage Section Storage areas differ from Working section storage areas. You’ve got a simple Storage Area A containing the value 0. You write a COBOL Program to ADD +1 TO A.

Case 1: If A were to be a Storage Area in the WORKING-STORAGE SECTION.



Each time the COBOL Program starts WS-A Storage Area is created with value 0, and the COBOL Program adds +1 to WS-A, so WS-A becomes 1. After the COBOL Program stops, WS-A is deleted. So, this doesn’t offer you memory of the past feature, with working storage areas you don’t remember, what was stored in WS-A previously, the last time the COBOL Program ran.

Case 2: If A were to be a Storage Area in the LINKAGE SECTION.



Here WS-A Storage which  is globally accessible and shared across the 1st run, 2nd run and the 3rd run of the COBOL. WS-A is a Linkage section Area, so this Storage area is independent of the COBOL Program. It helps to remember data of the past, pass data from one invocation(run) to the next successive invocation(run).

DFHCOMMAREA is a Linkage Section Storage Area that helps to store(save) data, pass data around from one invocation(run) to another invocation of a COBOL Online Program in CICS. Thus, Linkage-section storage area DFHCOMMAREA plays an important role to remember and retain data between two successive invocations.

你可能感兴趣的:(What is DFHCOMMAREA? Why is it a Linkage Section Storage Area?)