Previous Topic: How to Code an Update ApplicationNext Topic: Line Mode


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:

    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.