Difficulty: Medium
Correct Answer: INTO copies the map data into an application-defined area in the program, while SET returns a pointer to CICS-owned storage containing the map data without performing a copy
Explanation:
Introduction / Context:
In CICS Basic Mapping Support (BMS), the RECEIVE MAP command is used to receive data entered by a terminal user into a map. Developers can choose between the INTO and SET options to access this data. Interviewers often ask about the difference between these options because it affects performance, memory usage, and how programs reference the received data.
Given Data / Assumptions:
Concept / Approach:
With the INTO option, CICS moves the map data into an application-defined storage area, typically a working storage structure that matches the map layout. The program then references this local copy. With the SET option, CICS does not copy the data; instead, it returns a pointer (address) to CICS-owned storage containing the map data. The program uses this pointer to access the data directly. SET can improve performance by avoiding copy overhead, but it requires pointer capable languages and careful handling of CICS-managed storage.
Step-by-Step Solution:
Step 1: Using INTO, you code EXEC CICS RECEIVE MAP(map-name) INTO(map-area) LENGTH(length) END-EXEC. CICS copies the received map data into map-area, a structure defined in your program.
Step 2: After the INTO receive, the program accesses fields by referencing offsets within map-area, relying on the map copybook to interpret the data.
Step 3: Using SET, you code EXEC CICS RECEIVE MAP(map-name) SET(ptr-name) LENGTH(length) END-EXEC. CICS sets ptr-name to the address of its own storage that contains the map data, without copying it into your working storage.
Step 4: The program then uses ptr-name to reference the map data, typically combined with language constructs that support pointer arithmetic or structured references.
Step 5: Because SET avoids copying, it may be more efficient, but the data remains under CICS control, and the program must not assume that the storage persists indefinitely beyond the intended scope.
Verification / Alternative check:
Performance tests often show slightly lower CPU usage when using SET compared to INTO, especially for large maps, because fewer bytes are moved. The CICS documentation clearly differentiates the semantics of INTO and SET, emphasizing that INTO copies data to application storage while SET provides an address. Dump analysis and tracing tools reveal that in the SET case, the data resides in CICS control blocks rather than in the program’s working storage, confirming the conceptual difference between the two options.
Why Other Options Are Wrong:
Option B is incorrect because both INTO and SET are related to receiving maps; map sending uses SEND MAP commands and different options. Option C is wrong because validation of input fields depends on application logic and BMS definition, not on whether INTO or SET is used. Option D is incorrect because INTO and SET have different implementations and purposes; they are not synonyms and cannot be treated as interchangeable without consequences.
Common Pitfalls:
A common pitfall with INTO is unnecessary copying when maps are large and performance is critical, leading to extra CPU overhead. With SET, a major risk is mismanaging pointers, such as using the pointer after CICS has reused or freed the storage, which can cause data corruption or program abends. Developers must also ensure that their programming language supports pointer operations before using SET. Choosing between INTO and SET should be based on performance needs, language capabilities, and the desired lifetime and ownership of the received data.
Final Answer:
In EXEC CICS RECEIVE MAP, INTO copies the incoming map data into an application-defined area in your program, whereas SET returns a pointer to CICS-owned storage containing the map data so that you can access it without performing a copy.
Discussion & Comments