Acquiring and defining storage for the maps

The first step in creating mapped output is to provide storage in which to arrange the variable map data that your program passes to BMS.

About this task

If you place the map structure in working storage, CICS® does the allocation for you. (CICS allocates a private copy of working storage for each execution of a program, so that data from one task does not get confused with that from another, as explained in Program storage.) To use working storage, copy the symbolic map set there with the language statement provided for the purpose:
       COPY        in COBOL and assembler
       %INCLUDE    in PL/I
       #include    in C and C++
Working storage is the WORKING-STORAGE SECTION in COBOL, automatic storage in PL/I, C, C++, and DFHEISTG in a CICS assembler program. For example:
       WORKING-STORAGE SECTION.
       ...
       01  COPY QCKSET.
       ...
Alternatively, you can obtain and release map set storage as you need it, using CICS GETMAIN commands. (GETMAIN is discussed in Storage control.) In this case you copy the map into storage addressed by a pointer variable (the LINKAGE SECTION in COBOL, based storage in PL/I, C, and C++, a DSECT in assembler). On return from the GETMAIN, you use the address returned in the SET option to associate the storage with the data structure, according to the facilities of the programming language.
We used working storage in the example in Figure 4, but we could have used a GETMAIN. If we had, the code would change to:
       LINKAGE SECTION.
       ...
       01  COPY QCKSET.
       ...
       PROCEDURE DIVISION.
       ...
       MOVE LENGTH OF QCKMAPO TO LL.
       EXEC CICS GETMAIN SET(ADDRESS OF QCKMAPO)
                   LENGTH(LL) END-EXEC.
       ...
The length you need on your GETMAIN command is the length of the variable whose name is the map name suffixed by the letter “O”. In COBOL, PL/I, C, and C++, you can use language facilities to determine this length, as in the previous example. In assembler, it is defined in an EQUate statement whose label is the map name suffixed by “L”.