Using Pageable Maps

A pageable map can contain more occurrences of a set of map fields tha CAn fit on the screen at one time; therefore, it can contain unlimited occurrences of the set of map fields. Each occurrence of the multiply-occurring set is called a detail occurrence. The MAP OUT and MAP IN statements can create, retrieve, and modify detail occurrences of a pageable map.
idmscu19
A pageable map can contain more occurrences of a set of map fields tha CAn fit on the screen at one time; therefore, it can contain unlimited occurrences of the set of map fields. Each occurrence of the multiply-occurring set is called a
detail occurrence
. The MAP OUT and MAP IN statements can create, retrieve, and modify detail occurrences of a pageable map.
You should know about the following aspects of pageable maps:
  • The format of a pageable map
  • How to conduct a map paging session
  • How to code an application that allows the user to browse through a pageable map but not update it
  • How to code an update application that allows the user to perform database updates by using a pageable map
This article describes the following information:
2
2
Pageable Map Format
A pageable map is divided into the
header area
, the
detail area
, and the
footer area
. The header and footer areas consist of general information such as the map title, the page number, or the useable PF-keys. The detail area consists of detail occurrences.
For information on defining a pageable map, see Mapping Facility.
To prevent excessive database record locking, you should not define database records as map records in a pageable map; use IDD-defined work records instead.
Example of a Pageable Map
The figures below illustrate two pages of a map screen. Note that the display of information in the header and footer areas is unchanged except for the $PAGE field.
                                                        System-supplied                                                             $PAGE field                                                               │              ┌────────────────────────────────────────────────┼───────┐              │                                                │       │              │                                                ▼       │ ─┐              │ *** DEPARTMENT INFORMATION SCREEN *** PAGE: 0001       │  │ Header              │                                                        │  │ area              │ DEPARTMENT ID: 3200                                    │  │              │          NAME: COMPUTER OPERATIONS                     │ ─┘           ┌─ │                                                        │ ─┐ Detail    │  │                      EMPLOYEE ID:  0004                │  │ occurrence│  │                        LAST NAME:  CRANE               │  │           │  │                       FIRST NAME:  HERBERT             │  │ Detail           └─ │                                                        │  │ area              │                                                        │  │              │                      EMPLOYEE ID:  0032                │  │              │                        LAST NAME:  FERNDALE            │  │              │                       FIRST NAME:  JANE                │  │              │                                                        │  │              │                                                        │  │              │                      EMPLOYEE ID:  0045                │  │              │                        LAST NAME:  FONRAD              │  │              │                       FIRST NAME:  GEORGE              │  │              │                                                        │ ─┘              │                                                        │ ─┐              │PF8 NEXT PAGE *** PG7 PREVIOUS PAGE *** PA1 EXIT        │  │ Footer              │                                        APPLICATION     │  │ area              └────────────────────────────────────────────────────────┘ ─┘ ┌──────────────────────────────────────────────────────────────────────────┐ │                                                                          │ │                                                                          │ │           *** DEPARTMENT INFORMATION SCREEN ***           PAGE: 0002     │ │                                                                          │ │   DEPARTMENT ID: 3200                                                    │ │            NAME: COMPUTER OPERATIONS                                     │ │                                                                          │ │                  EMPLOYEE ID:  0053                                      │ │                    LAST NAME:  GARDNER                                   │ │                   FIRST NAME:  ROBIN                                     │ │                                                                          │ │                                                                          │ │                  EMPLOYEE ID:  0031                                      │ │                    LAST NAME:  LIPSICH                                   │ │                   FIRST NAME:  HERBERT                                   │ │                                                                          │ │                                                                          │ │                                                                          │ │                                                                          │ │                                                                          │ │                                                                          │ │                                                                          │ │    PF8 NEXT PAGE *** PG7 PREVIOUS PAGE *** PA1 EXIT APPLICATION          │ │                                                                          │ └──────────────────────────────────────────────────────────────────────────┘
Conducting a Map Paging Session
A map paging session involves interaction among the user, the run-time mapping system, and your map paging application program. You should understand this interaction and the sequence of events that occurs during a map paging session before planning the logic of your application program.
Typical Map Paging Sequence
This sequence of events typically occurs during a map paging session:
  1. Your program begins the session and defines map paging parameters
  2. The program creates detail occurrences
  3. A map page is displayed on the terminal
  4. The user pages forward and backward through the pageable map
  5. The user optionally modifies map data fields
  6. The program receives control and updates the database
  7. The user ends the map paging session
The following discussion describes each step in detail.
Beginning the Paging Session
A map paging session begins when your program issues a STARTPAGE statement. Options included in this statement specify the following:
  • The runtime flow of control
    . The paging type (NOWAIT/WAIT/RETURN) determines whether the run-time mapping system or your program receives control when the user presses a control key, as detailed in the table below.
    The paging type affects the frequency with which your program will receive control and the processing logic you must provide. For example, in NOWAIT, run-time mapping performs all paging operations for you; in WAIT and RETURN, you must provide coding logic that performs the paging operations specified by the user.
    NOWAIT is best for applications in which the user can display but not update; WAIT and RETURN are best for update applications.
  • Whether the user can display a previous map page
    . If backpaging is allowed, the run-time system must maintain the resources that describe the detail occurrences of previous pages. If backpaging is not allowed, the run-time system deletes all previous pages of detail occurrences when a new map page is displayed.
    Always allow backpaging for pageable map applications that perform database updates.
  • Whether the user can update map data fields
    . A paging mode of UPDATE specifies that the user can modify map data fields, subject to restrictions specified in the map and by previous MODIFY MAP statements. BROWSE specifies that the user can modify only the system-supplied $PAGE field (if present).
The tables below summarize flow of control in a map paging session.
  • Paging request*:
Paging Type
No Data Fields Modified
Data Fields Modified**
NOWAIT
Run-time mapping displays the requested map page
Run-time mapping displays the requested map page
WAIT
Run-time mapping displays the requested map page
Control passes to the program
RETURN
Control passes to the program
Control passes to the program
* If the user presses Clear, PA1, PA2, or PA3, and that key is not associated with backward or forward paging, refer instead to "Nonpaging request" below.
** If the user presses Clear, PA1, PA2, or PA3, refer to the "No data fields modified" column.
  • Nonpaging request:
Paging Type
No Data Fields Modified
Data Fields Modified**
NOWAIT
Control passes to the program
Run-time mapping redisplays the same map page
WAIT
Control passes to the program
Control passes to the program
RETURN
Control passes to the program
Control passes to the program
** If the user presses Clear, PA1, PA2, or PA3, refer to the "No data fields modified" column.
Creating Detail Occurrences
Your program retrieves data, moves it to map data fields, and creates detail occurrences by issuing MAP OUT DETAIL commands.
Displaying the First Page
The first page is displayed on the terminal screen in one of the following ways:
  • Run-time mapping
    automatically displays the first map page when the first detail occurrence of the second page of occurrences is created. The program continues to execute and create additional detail occurrences.
    When the first page is displayed by run-time mapping, DC returns a status of 4676 (DC-FIRST-PAGE-SENT). Your program must check for this status after every MAP OUT DETAIL statement.
  • Your program displays the first map page
    . When all detail occurrences are created, your program should check to determine if the first page was written to the terminal. You do this by setting a switch when DC returns a status of 4676 (DC-FIRST-PAGE-SENT). If 4676 was never returned, your program explicitly displays the first map page by issuing a MAP OUT RESUME statement.
Paging Forward and Backward
To specify the next map page to be displayed, the user does one of the following:
  • Presses the control key associated with paging forward one page
  • Presses the control key associated with paging backward one page
  • Changes the $PAGE map field, if defined on the map, and presses a control key other than Clear, PA1, PA2, or PA3.
Modifying Map Fields
The user can change map data fields, including header and footer data fields, subject to restrictions specified by the STARTPAGE command (UPDATE/BROWSE) or by a previously specified MODIFY MAP command.
Updating the Database
If the user has modified any map data fields or if the paging type is RETURN, the program reads modified detail occurrences and updates the database.
A modified detail occurrence contains one or more map fields whose modified data tags (MDTs) are set on.
To retrieve a modified detail occurrence
, issue a MAP IN DETAIL statement. MAP IN DETAIL can retrieve a modified detail occurrence sequentially, by the order of detail occurrences, or randomly by a key value that can be associated with an occurrence. If sequential or random retrieval cannot retrieve a modified detail occurrence, DC returns a status of 4668 (DC-NO-MORE-UPD-DETAILS).
If you need to modify the current detail occurrence
(for example, to send an error message), issue a MAP OUT DETAIL CURRENT statement. This statement modifies the detail occurrence most recently referenced by a MAP IN DETAIL or MAP OUT DETAIL statement.
After processing all modified detail occurrences
, write the map to the terminal screen by issuing a MAP OUT RESUME statement. If WAIT or RESUME has been specified, your program is responsible for displaying the next page specified by the user.
If you need to create additional detail occurrences
, you can do so at any time by issuing further MAP OUT DETAIL statements. The new occurrences are stored at the end of the set of detail occurrences.
Ending the Paging Session
When a map paging session ends, the system deletes all the detail occurrences created during the session. To end a session, issue an ENDPAGE SESSION command.
How to Code a Browse Application
To write a pageable map application that allows the user to display data but not update it, perform the following steps:
  1. Establish a switch in variable storage. This switch should be set on if run-time mapping has transmitted the first page.
  2. Issue mapping mode housekeeping statements, as explained in Housekeeping.
  3. Initiate the map paging session by issuing a STARTPAGE statement that specifies NOWAIT and BROWSE.
  4. Initialize header data fields.
  5. Perform the following steps iteratively until all data is retrieved:
    1. Perform database retrieval and move data to map data fields in variable storage.
    2. Issue a MAP OUT DETAIL NEW statement, checking for a status of 4676 (DC-FIRST-PAGE-SENT).
    3. Set the first-page switch if 4676 is returned; perform the IDMS-STATUS routine if 4676 is not returned.
Ending the Browse Session
If, after all detail occurrences have been created, the first-page switch is not set, you should transmit the map page to the terminal screen by issuing a MAP OUT RESUME statement.
The next task specified in the DC RETURN NEXT TASK CODE statement should include logic that tests to see if the user has indicated the end of the map paging session. If so, issue an ENDPAGE SESSION statement.
Example of a Browse Application
The program excerpt below shows a pageable map application in which run-time mapping handles all paging requests (paging type of NOWAIT) and the operator cannot make updates (paging mode of BROWSE).
After acquiring the data passed from a previous task and establishing that database records are present, this program issues MAP OUT DETAIL statements iteratively until all detail occurrences are written. DEPTEND, which is specified as the next task, ends the paging session with the ENDPAGE command and performs processing based on the control key pressed.
 DATA DIVISION  01  FIRST-PAGE-SW           PIC X  VALUE 'N'.         88 LESS-THAN-A-PAGE     VALUE 'N'.  01  MAP-WORK-REC.      05 WORK-FIRST            PIC X(10).      05 WORK-LAST             PIC X(15).      05 WORK-EMP-ID           PIC X(4).  LINKAGE SECTION.  01  PASS-DEPT-INFO.      05 PASS-DEPT-ID         PIC 9(4).      05 PASS-DEPT-INFO-END   PIC X.    PROCEDURE DIVISION.      BIND MAP DCTEST01.      BIND MAP DCTEST01 RECORD MAP-WORK-REC. *** ACQUIRE DEPT-ID FROM ERROR CHECKING PROGRAM ***      GET STORAGE FOR PASS-DEPT-INFO TO                     PASS-DEPT-INFO-END         WAIT SHORT USER         STGID 'RKNS'. *      MOVE PASS-DEPT-ID TO DEPT-ID-0410.      FREE STORAGE STGID 'RKNS'. *      COPY IDMS SUBSCHEMA-BINDS.      READY USAGE-MODE RETRIEVAL. *      OBTAIN CALC DEPARTMENT        ON DB-REC-NOT-FOUND GO TO NO-DEPT-ERR.      IF DEPT-EMPLOYEE IS EMPTY            GO TO NO-EMP-ERR. *** BEGIN MAP PAGING SESSION *** STARTPAGE SESSION DCTEST01 NOWAIT BACKPAGE BROWSE.      PERFORM A100-GET-EMPLOYEES THRU A100-EXIT                       UNTIL DB-END-OF-SET.      FINISH. *** IF FIRST PAGE NOT YET SENT, MAP OUT RESUME *** IF LESS-THAN-A-PAGE MAP OUT USING DCTEST01 RESUME. *** NEXT TASK ENDS PAGING SESSION ***      DC RETURN NEXT TASK CODE 'DEPTEND'.    A100-GET-EMPLOYEES.      OBTAIN NEXT WITHIN DEPT-EMPLOYEE         ON DB-END-OF-SET GO TO A100-EXIT.      MOVE EMP-FIRST-NAME-0415 TO WORK-FIRST.      MOVE EMP-LAST-NAME-0415 TO WORK-LAST.      MOVE EMP-ID-0415 TO WORK-EMP-ID. *** MAP OUT CURRENT DETAIL, CHECK FOR ERROR-STATUS OF 4676 *** MAP OUT USING DCTEST01 DETAIL NEW ON DC-FIRST-PAGE-SENT MOVE 'Y' TO FIRST-PAGE-SW.  A100-EXIT.      EXIT.  .  .  . *** FURTHER PROCESSING, INCLUDING ERROR ROUTINES ***
How to Code an Update Application
To write a pageable map application that allows the user to update map data fields, establish a retrieval program and an update program.
Retrieval Program
The retrieval program initiates the pageable map update session and retrieves and displays the data. This program can be similar to the one displayed in How to Code a Browse Application. You should make the following changes to the retrieval program:
  • Specify one of the following options of the STARTPAGE statement:
    • WAIT
      causes your program to acquire control after every
      update
      paging request and after every nonpaging request.
    • RETURN
      causes your program to acquire control after
      every
      paging request (update or nonupdate) and every nonpaging request.
    Because of editing and error-handling considerations, updating pageable maps by using a paging type of NOWAIT is not recommended.
  • Use the KEY IS parameter of the MAP OUT DETAIL statement to pass the db-key of each retrieved record:
    MAP OUT USING DCTEST01     DETAIL NEW     KEY IS DBKEY.
    Including the db-key in this manner allows for DB-KEY retrieval in subsequent tasks.
  • Code a DC RETURN statement that indicates the pageable map update program to be invoked when the user presses a control key.
Update Program
The update program retrieves modified detail occurrences and updates the database. In this program, perform the following steps:
  1. Establish a switch in variable storage. This switch should be set on if your program encounters any invalid data in modified detail occurrences.
  2. Issue mapping mode housekeeping statements, as explained in Housekeeping.
  3. Issue a MAP IN HEADER statement that includes the PAGE option. You can use the PAGE value later in your program when determining the next page to map out.
  4. Issue an INQUIRE MAP statement to determine what control key was pressed. The control key pressed by the user can specify:
    • The flow of control
      . You can associate certain control keys with specific functions (for example, Clear might always exit the application).
    • The next page to be displayed
      . The user can indicate the next page to be displayed by pressing a site-standard paging control key.
    • A user error
      . If the user presses an invalid control key, you should redisplay the current page.
  5. Perform the following steps iteratively until all modified detail occurrences have been mapped in:
    1. Issue a MAP IN DETAIL statement that includes the RETURNKEY parameter.
    2. Check for a status of 4668 (DC-NO-MORE-UPD-DETAILS). If 4668 is returned, all updated details have been returned and you should display the pageable map, as specified by the user. If 4668 is not returned, perform the IDMS-STATUS routine.
    3. Perform error and range checking to ensure that the user entered valid data. If invalid data is found, set the error switch and issue a MAP OUT DETAIL CURRENT statement that includes a message that indicates the error.
    4. Perform database retrieval to access the database record to be modified. Retrieve the record by using its db-key (acquired from the RETURNKEY parameter). If data cannot be retrieved, set the error switch and issue a MAP OUT DETAIL CURRENT statement that includes a message that indicates the error.
    5. Move data from the work record to the database record.
    6. Issue database modification statements.
    7. After all modified detail occurrences have been successfully processed, issue a MAP OUT RESUME statement that specifies the page requested by the user. If errors were encountered in the MAP IN DETAIL processing, you should redisplay the current page so the operator can correct the invalid data.
Ending the Update Session
The next task specified in the DC RETURN NEXT TASK CODE statement should include logic that tests to see if the user has indicated the end of the map paging session. If so, issue an ENDPAGE SESSION statement.
Example of an Update Application
The program excerpt below shows a pageable map update application. The program contains paging logic that works with a paging type of either WAIT or RETURN.
After determining user specifications, the program issues MAP IN DETAIL statements iteratively, modifying the database as specified, until all modified detail occurrences are processed.
 DATA DIVISION  WORKING-STORAGE SECTION.  01  RETURN-DBKEY            PIC S9(8) COMP.  01  DEPTMOD                 PIC X(8) VALUE 'DEPTMOD'.  01  FIRST-PAGE-SW           PIC X    VALUE 'N'.         88 LESS-THAN-A-PAGE  VALUE 'N'.  01  MAP-IN-ERR-SW           PIC X    VALUE 'N'.         88 MAP-IN-ERR        VALUE 'Y'.  01  PAGE-INDICATOR.      05 SPEC-PAGE            PIC S9(8) COMP.  01  MESSAGES.      05 EDIT-ERR-MESS           PIC X(21)         VALUE 'CORRECT INVALID INPUT'.      05 EDIT-ERR-MESS-END       PIC X. *      05 EMP-NOT-FOUND-MESS      PIC X(18)         VALUE 'EMPLOYEE NOT FOUND'.      05 EMP-NOT-FOUND-MESS-END  PIC X.  01  DC-AID-CONDITION-NAMES.       03  DC-AID-IND-V           PIC X.                              88  ENTER-HIT VALUE QUOTE.                              88  CLEAR-HIT VALUE '_'.                              88  PF01-HIT VALUE '1'.                              88  PF02-HIT VALUE '2'.                              88  PF03-HIT VALUE '3'.                              88  PF04-HIT VALUE '4'.                              88  PF05-HIT VALUE '5'.                              88  PF06-HIT VALUE '6'.                              88  PF07-HIT VALUE '7'.                              88  PF08-HIT VALUE '8'.                              88  PF09-HIT VALUE '9'.                              88  PF10-HIT VALUE ':'.                              88  PF11-HIT VALUE '#'.                              88  PF12-HIT VALUE '@'.                              88  PF13-HIT VALUE 'A'.                              88  PF14-HIT VALUE 'B'.                              88  PF15-HIT VALUE 'C'.                              88  PF16-HIT VALUE 'D'.                              88  PF17-HIT VALUE 'E'.                              88  PF18-HIT VALUE 'F'.                              88  PF19-HIT VALUE 'G'.                              88  PF20-HIT VALUE 'H'.                              88  PF21-HIT VALUE 'I'.                              88  PF22-HIT VALUE '_'.                              88  PF23-HIT VALUE '.'.                              88  PF24-HIT VALUE '>'.                              88  PA01-HIT VALUE '%'.                              88  PA02-HIT VALUE '<'.                              88  PA03-HIT VALUE ','.                              88  PEN-ATTN-SPACE-NULL VALUE '='.                              88  PEN-ATTN VALUE QUOTE.  01  MAP-WORK-REC.      05 WORK-EMP-ID           PIC X(4).      05 WORK-FIRST            PIC X(10).      05 WORK-LAST             PIC X(15).    PROCEDURE DIVISION.      BIND MAP DCTEST01.      BIND MAP DCTEST01 RECORD MAP-WORK-REC.      MOVE 'N' TO MAP-IN-ERR-SW. *** MAP IN HEADER AND PAGE FIELD *** MAP IN USING DCTEST01 HEADER PAGE IS SPEC-PAGE ON DC-DETAIL-NOT-FOUND NEXT SENTENCE. *** DETERMINE THE PF-KEY PRESSED *** INQUIRE MAP DCTEST01 MOVE AID TO DC-AID-IND-V. IF PA01-HIT ENDPAGE DC RETURN. *** CHECK FOR HEADER ERRORS, MAP OUT IF ANY ARE FOUND ***      INQUIRE MAP DCTEST01         IF ANY EDIT IS ERROR           THEN             MODIFY MAP DCTEST01 TEMPORARY                  FOR ALL ERROR FIELDS                  ATTRIBUTES BRIGHT             MAP OUT USING DCTEST01 RESUME             DC RETURN NEXT TASK CODE DEPTMOD. *      COPY IDMS SUBSCHEMA-BINDS.      READY ORG-DEMO-REGION USAGE-MODE IS UPDATE.      READY EMP-DEMO-REGION USAGE-MODE IS UPDATE. *      PERFORM A100-MAP-IN-DETAILS THRU A100-EXIT             UNTIL DC-NO-MORE-UPD-DETAILS.      FINISH. *** PAGING ROUTINES FOLLOW *** *** IF ERROR SWITCH IS SET, REDISPLAY CURRENT PAGE *** IF MAP-IN-ERR THEN MAP OUT USING DCTEST01 RESUME PAGE IS CURRENT DC RETURN NEXT TASK CODE DEPTMOD. *** IF PF07, DISPLAY PRIOR PAGE *** IF PF07-HIT THEN MAP OUT USING DCTEST01 RESUME PAGE IS PRIOR DC RETURN NEXT TASK CODE DEPTMOD. .hr left right *** IF PF08, DISPLAY NEXT PAGE ***      IF PF08-HIT        THEN         MAP OUT USING DCTEST01             RESUME PAGE IS NEXT         DC RETURN NEXT TASK CODE DEPTMOD. *** ELSE, USE PAGE VALUE FROM MAP IN HEADER ***      MAP OUT USING DCTEST01          RESUME PAGE IS SPEC-PAGE.      DC RETURN NEXT TASK CODE DEPTMOD.  A100-MAP-IN-DETAILS. *** MAP IN EACH MODIFIED DETAIL. EXIT *** *** WHEN NO MORE MODIFIED DETAILS REMAIN *** MAP IN USING DCTEST01 DETAIL RETURNKEY IS RETURN-DBKEY ON DC-NO-MORE-UPD-DETAILS GO TO A100-EXIT. *** IF ERROR, MAP OUT DETAIL WITH MESSAGE, SET SWITCH ***      INQUIRE MAP DCTEST01         IF ANY EDIT IS ERROR           THEN             MODIFY MAP DCTEST01 TEMPORARY                  FOR ALL ERROR FIELDS                  ATTRIBUTES BRIGHT MAP OUT USING DCTEST01 MESSAGE IS EDIT-ERR-MESS TO EDIT-ERR-MESS-END DETAIL CURRENT KEY IS RETURN-DBKEY MOVE 'Y' TO MAP-IN-ERR-SW GO TO A100-EXIT. *** RETRIEVE EMPLOYEE, USING DBKEY FROM RETURNKEY ***      OBTAIN EMPLOYEE DB-KEY IS RETURN-DBKEY                  ON ANY-STATUS NEXT SENTENCE. *** IF ERROR, MAP OUT DETAIL WITH MESSAGE, SET SWITCH ***      IF DB-REC-NOT-FOUND MAP OUT USING DCTEST01 MESSAGE IS EMP-NOT-FOUND-MESS TO EMP-NOT-FOUND-MESS-END DETAIL CURRENT KEY IS RETURN-DBKEY MOVE 'Y' TO MAP-IN-ERR-SW GO TO A100-EXIT      ELSE         PERFORM IDMS-STATUS. *      MOVE WORK-FIRST  TO EMP-FIRST-NAME-0415.      MOVE WORK-LAST   TO EMP-LAST-NAME-0415.      MOVE WORK-EMP-ID TO EMP-ID-0415.      MODIFY EMPLOYEE.  A100-EXIT.      EXIT.
Overriding Automatic Mapout for Pageable Maps
You can override the automatic mapout of a pageable map's first page.
By default, the first page of a pageable map is displayed as soon as the first detail occurrence of the second map page is written to scratch.
You can override this automatic mapout by specifying NOAUTODISPLAY in your STARTPAGE statement. By overriding the automatic display of the map's first page, you can add messages or modify the map before the page is displayed.
Return Code for Map Page Built
A map paging return code tells you before mapout whether a map page has been built.
The table below lists the map paging return code for map page built in COBOL, PL/I, and Assembler.
The listed code is returned as soon as a map page is built and before mapout.
Language
Return code
Description
COBOL and PL/I
4680
Returned in: IDMS communications block status code field
Returned after: MAP OUT DETAIL statement for a pageable map
Represented by the COBOL 88-level status code DC-PAGE-READY.
Assembler
X'50'
Returned in: DC/UCF run-time register 15
Returned after: #MREQ OUT DETAIL=YES statement for a pageable map
How to Code a Noautosave Application
To code a pageable map application that does not automatically mapout when the first map page is built, perform the following steps:
  1. Issue mapping mode housekeeping statements, as explained in Housekeeping.
  2. Initiate a map paging session by issuing a STARTPAGE statement that specifies NOAUTODISPLAY.
    STARTPAGE SESSION MAP01 NOAUTODISPLAY
  3. Initialize header data fields.
Map Out Detail Occurrences
Perform the following steps iteratively until all data is retrieved:
  1. Perform database retrieval and move data to map data fields in variable storage.
  2. Issue a MAP OUT DETAIL statement. After each pageable map statement that writes a detail occurrence, test for DC-PAGE-READY to determine whether a map page has been built.
    MAP OUT USING MAP01 OUTPUT DATA IS YES     DETAIL NEW         ON DC-PAGE-READY PERFORM FIRST-PAGE THRU FIRST-PAGE-XIT.  .  .  .
  3. If you do find DC-PAGE-READY, you can optionally:
    • Modify the map.
    • Define messages to display on mapout.
    If you do not find DC-PAGE-READY, perform the IDMS-STATUS routine.
  4. Manually map out the first page:
    FIRST-PAGE.   MAP OUT USING MAP01 OUTPUT DATA IS YES      RESUME PAGE FIRST
If You Never Find DC-PAGE-READY
If, after all detail occurrences have been created, you have not received a DC-PAGE-READY status code, you should transmit the map page to the terminal screen by issuing a MAP OUT RESUME statement.
Ending the Paging Session
The next task specified in the DC RETURN NEXT TASK CODE statement should include logic to test whether the user has indicated the end of the map paging session. If so, issue an ENDPAGE SESSION statement.
Example of Suppressing Automatic Mapout
The following application does not automatically display the first page after it has been built.
     OBTAIN CALC DEPARTMENT        ON DB-REC-NOT-FOUND GO TO NO-DEPT.      IF DEPT-EMPLOYEE IS EMPTY            GO TO NO-EMP.      MOVE DEPT-ID-0410 TO WORK-DEPT-ID.      STARTPAGE SESSION DCTEST01           NOWAIT           BACKPAGE           BROWSE           NOAUTODISPLAY.      PERFORM A100-GET-EMPLOYEES THRU A100-EXIT                       UNTIL DB-END-OF-SET.      FINISH.      IF LESS-THAN-A-PAGE         MAP OUT USING DCTEST01 RESUME.      DC RETURN NEXT TASK CODE 'DEPTEND'.  A100-GET-EMPLOYEES.      OBTAIN NEXT WITHIN DEPT-EMPLOYEE         ON DB-END-OF-SET GO TO A100-EXIT.      MOVE EMP-ID-0415 TO WORK-EMP-ID.      MOVE EMP-LAST-NAME-0415 TO WORK-LAST.      MOVE EMP-FIRST-NAME-0415 TO WORK-FIRST.      MAP OUT USING DCTEST01 OUTPUT DATA IS YES               DETAIL NEW      ON ANY-STATUS         NEXT SENTENCE.      IF DC-PAGE-READY             PERFORM A100-FIRST-PAGE THRU                     A100-FIRST-PAGE-EXIT         ELSE PERFORM IDMS-STATUS.  A100-EXIT.      EXIT.  A100-FIRST-PAGE.      MOVE 'Y' TO FIRST-PAGE-SW.      IF ALREADY-MAPPED-OUT         GO TO A100-FIRST-PAGE-EXIT      ELSE         MOVE EMP-MESSAGE-01 TO MESSAGE-01         MAP OUT USING DCTEST01 OUTPUT DATA IS YES         RESUME PAGE FIRST  A100-FIRST-PAGE-EXIT.      EXIT.