Mapping Mode

Contents
idmscu
Contents
In mapping mode, your program communicates with 3270-type terminal devices. DC uses maps to associate screen positions on the terminal with fields in program variable storage.
Example of Map Data Fields
The EMPDISPM map below associates row 4, column 24, with the EMP-ID-0415 field in variable storage; the map associates row 5, column 24, with the EMP-LAST-NAME-0415 field, and so on.
*** EMPLOYEE INFORMATION SCREEN *** EMPLOYEE ID : ____ LAST NAME : ____________ FIRST NAME : ________________ ADDRESS : ________________ : ____________ : __ __________ DEPARTMENT : ____________________ ENTER AN EMPLOYEE ID AND PRESS ENTER *** PRESS CLEAR TO EXIT
Creating a Map
To transfer data in mapping mode, you must first create a map by using either the online or batch compiler of the CA IDMS Mapping Facility. You associate map variable fields with either database records or IDD-defined work records.
Maps are available as load modules to the DC run-time system. DC views map load modules as programs.
Mapping Mode Terminal Management
Using mapping mode terminal management, you can perform the following functions:
  • Write data to a terminal screen
  • Read data input from a terminal screen and query the status of conditions related to the input operation
  • Modify previously established map and map field options
  • Write unlimited detail occurrences that can be displayed one page at a time by using a pageable map
Mapping Terminology
You should understand the following terms related to maps:
  • Attribute byte
    -The nondisplayable byte that begins each map field at run time. The contents of the attribute byte determine the characteristics of the field (such as protection and intensity). Attributes bytes are a 3270 feature.
  • Automatic editing and error handling
    -An optional map feature that can be used to perform editing and error-handling functions at run time. These functions can compare input and output data with internal and external pictures, validate data against edit tables, and encode or decode data through code tables.
  • Modified data tag (MDT)
    -:ih1.modified data tag The internal switch for a map data field that indicates whether the value in that field has been changed by the user. Modified data tags are a 3270 feature.
  • Write control character (WCC)
    -The internal character that holds various specifications for the display of the map such as resetting the keyboard to allow user input. Write control characters are a 3270 feature.
For a complete description of maps and map attributes, see "Mapping Facility."
Housekeeping
To define the map to the precompiler at compile time, and to establish addressability to DC at run time, you must perform certain mapping mode housekeeping functions:
  • Identify the map you want to use
    by including a MAP SECTION (COBOL), a DECLARE MAP statement (PL/I), or the MAP parameter in the @INVOKE statement (Assembler).
  • Copy the map request block (MRB) and the map records
    by including compiler-directive statements in program variable storage.
  • Establish addressability between DC and the MRB
    by issuing a BIND MAP statement.
  • Establish addressability to map records
    by issuing a BIND MAP RECORD statement for each record defined for the map.
For more information on mapping mode housekeeping statements, see the language-specific
CA IDMS DML Reference section
.
Displaying Screen Output
To display a map on the terminal screen, perform the following steps:
  1. Issue mapping mode housekeeping statements as described above.
  2. Initialize variable-storage data fields as needed.
  3. Transfer data from variable-storage data fields to map fields on the screen by issuing a MAP OUT statement.
You can also use the MAP OUT statement to transfer data between two variable-storage data fields; this is referred to as a
native mode data transfer
.
For more information about native mode data transfers, see the language-specific
CA IDMS DML Reference section
.
Pageable maps have different output considerations. For more information, see Using Pageable Maps.
Mapping Considerations
You need to know about the following considerations when writing a program that displays maps:
  • Sending informational messages to the user
  • Keeping the data stream short
  • Choosing asynchronous or synchronous processing
Sending Informational Messages
You can send a variety of messages to the user's terminal, depending on the situation. For example, if the application is being accessed for the first time, you might transmit the following message:
ENTER AN EMPLOYEE ID AND PRESS ENTER **** PRESS CLEAR TO EXIT You might send a different message with the same map at another time to indicate the completion status of a task: **** SPECIFIED EMPLOYEE CANNOT BE FOUND ****
'COBOL and PL/I programmers'. To avoid unpredictable results at run time, specify messages that are 100 bytes or less in length.
Keeping the Data Stream Short
Because you want to promote the fastest possible response time, an important programming consideration is the length of the data stream transmitted to or from the terminal. You should ensure that your program always transmits the smallest amount of data necessary to successfully complete a mapping operation.
Ways to minimize the data stream include:
  • Avoid rewriting literals
    . If you are rewriting to the same map, there usually is no need to retransmit literal fields. Specify the NEWPAGE and the LITERALS options only on an initial map output.
  • Transmit only the attribute bytes
    . If your program determines that the user has entered invalid data, you need not retransmit the invalid values; these values are still listed on the terminal screen. Instead, you can specify OUTPUT DATA IS ATTRIBUTE to transmit only the attribute bytes for map fields.
    The ATTRIBUTE specification is useful when sending error messages to the terminal because DC still transmits the data in the message field. For example, you could minimize the data stream transmitted by coding the following MAP OUT statement:
    MAP OUT USING DEPTMAP
    OUTPUT DATA IS ATTRIBUTE MESSAGE IS ID-EDIT-ERROR-MESS TO ID-EDIT-ERROR-MESS-END.
    If automatic editing and error handling are enabled and you use the ERROR option of the MODIFY MAP statement, the ATTRIBUTE specification is automatically invoked.
Synchronous and Asynchronous Processing
Mapping mode supports synchronous and asynchronous map output operations:
  • During a
    synchronous
    map output request, DC places your task in an inactive state until processing is complete.
    To issue a synchronous map output request, specify the WAIT option of the MAP OUT statement. This option allows you to ensure that the output request was completed successfully before continuing program processing.
  • During an
    asynchronous
    map output request, DC returns control to your task before the output processing is complete. Before issuing subsequent map output requests, you must ensure that the first request is finished by issuing a CHECK TERMINAL request. CHECK TERMINAL is a basic mode DML statement that is described in Basic Mode.
    To issue an asynchronous map output request, specify the NOWAIT option of the MAP OUT statement.
    You may want to specify NOWAIT if your program issues a MAP OUT just before task termination. This causes DC to release a task's resources sooner. In this case, however, you cannot issue the CHECK TERMINAL statement; you won't be able to determine the completion status of the MAP OUT operation.
Example of an Initial Application Screen
The program excerpt below displays an application's initial screen. It initializes the EMP-ID-0415 field and displays the screen, soliciting user input.
DATA DIVISION. WORKING-STORAGE SECTION. 01 TSK02 PIC X(8) VALUE 'TSK02'. 01 MESSAGES. 05 INITIAL-MESSAGE PIC X(54) VALUE 'ENTER AN EMPLOYEE ID AND PRESS ENTER *** CLEAR TO EXIT'. 05 INITIAL-MESSAGE-END PIC X. PROCEDURE DIVISION. *** ESTABLISH ADDRESSABILITY TO MAP *** BIND MAP SOLICIT. *** ESTABLISH ADDRESSABILITY TO MAP RECORDS *** BIND MAP SOLICIT RECORD EMPLOYEE. BIND MAP SOLICIT RECORD DATE-WORK-REC. MOVE ZERO TO EMP-ID-0415.
*** DISPLAY THE MAP ***
MAP OUT USING SOLICIT
WAIT NEWPAGE
MESSAGE IS INITIAL-MESSAGE TO INITIAL-MESSAGE-END.
*** RETURN CONTROL TO CA-IDMS/DC NEXT TASK TSK02 *** DC RETURN NEXT TASK CODE TSK02.
Reading Screen Input
When the user finishes inputting data and presses an AID key, DC invokes the specified input task. The task reads data from the screen and tests for certain input conditions.
To transfer data from map fields on the terminal screen to the corresponding variable storage data fields, perform the following steps:
  1. Issue mapping mode housekeeping statements, as explained in Housekeeping.
  2. Transfer data from map fields on the terminal screen to variable-storage data fields by issuing a MAP IN statement.
You can use the MAP IN statement to transfer data between two variable-storage data fields; this is referred to as a
native mode data transfer
.
For more information about native mode data transfers, see the language-specific
CA IDMS DML Reference section
.
Pageable maps have different input considerations. For more information, see Using Pageable Maps.
Example of Reading Input
The program excerpt below reads data from the screen.
It transfers data from the terminal screen to map data fields in program variable storage by issuing a MAP IN statement.
PROCEDURE DIVISION. *** ESTABLISH ADDRESSABILITY TO THE MAP *** BIND MAP SOLICIT. *** ESTABLISH ADDRESSABILITY TO THE MAP RECORDS *** BIND MAP SOLICIT RECORD EMPLOYEE. BIND MAP SOLICIT RECORD EMP-DATE-WORK-REC.
*** TRANSFER DATA FROM MAP DATA FIELDS TO VARIABLE STORAGE ***
MAP IN USING SOLICIT.
*** FURTHER PROCESSING OF ENTERED DATA ***
Testing for Input Conditions
After a MAP IN request, your program can inquire about conditions related to the input operation. For example, you may need to perform processing based on the AID key pressed by the user or determine if the user entered data in a particular map data field.
To test for conditions related to a map input operation, issue an INQUIRE MAP statement. By using this statement, you can obtain the following information:
  • The control key pressed.
  • The current cursor position.
  • Information on conditions regarding a map data field or group of map data fields:
    • Is data present?
    • Has data been modified?
    • Has data been truncated?
    • What is the entered length of a specific map input field?
  • Whether specified map fields are in error (the error flag has been set on for those fields) or are correct (the error flag has been set off). This option applies only to those maps and map fields for which automatic editing is enabled.
  • Whether the screen was formatted before the input operation was performed.
Frequent uses of the INQUIRE MAP statement are listed below:
  • To determine what control key was pressed
    . Typically, an application offers various processing options to the user. Each option can be associated with a control key. Your program should check the AID byte after every MAP IN statement to determine the option chosen. The table below lists the AID characters associated with each 3270-type control key.
Key
AID character
Enter
" ' " (single quote)
Clear
'_' (underscore)
PF1
'1'
PF2
'2'
PF3
'3'
PF4
'4'
PF5
'5'
PF6
'6'
PF7
'7'
PF8
'8'
PF9
'9'
PF10
':'
PF11
'#'
PF12
'@'
PF13
'A'
PF14
'B'
PF15
'C'
PF16
'D'
PF17
'E'
PF18
'F'
PF19
'G'
PF20
'H'
PF21
'I'
PF22
'&cent.'
PF23
'.'
PF24
'<'
PA1
'%'
PA2
'>'
PA3
','
  • To ensure that necessary data has been entered
    . You should make sure that the user has entered data in all fields necessary for successful processing.
  • To determine if automatic editing and error-handling have detected any errors
    . If input errors are detected, DC automatically transmits only the attribute bytes for the next map output operation.
You can use the TASK CODE parameter of the ACCEPT statement to retrieve the calling task code.
For more information about the ACCEPT statement, see Retrieving Task-Related Information.
The program excerpt below performs processing based on conditions related to the last map input operation. It uses the INQUIRE MAP statement to determine what control key was pressed and to ensure that the DEPT-ID-0410 field contains data.
DATA DIVISION. WORKING-STORAGE SECTION. 01 DC-AID-CONDITION-NAMES. 03 DC-AID-IND-V PIC X. 88 ENTER-HIT VALUE QUOTE. 88 CLEAR-HIT VALUE '_'. PROCEDURE DIVISION. *** ESTABLISH ADDRESSABILITY TO THE MAP AND MAP RECORDS *** BIND MAP SOLICIT. BIND MAP SOLICIT RECORD EMPLOYEE. BIND MAP SOLICIT RECORD DEPARTMENT. BIND MAP SOLICIT RECORD EMP-DATE-WORK-REC. *** TRANSFER DATA FROM THE MAP TO VARIABLE STORAGE *** MAP IN USING SOLICIT.
*** DETERMINE THE AID KEY PRESSED BY THE TERMINAL OPERATOR ***
INQUIRE MAP SOLICIT
MOVE AID TO DC-AID-IND-V.
*** IF OPERATOR PRESSED CLEAR THEN DC RETURN *** IF CLEAR-HIT DC RETURN. *** DETERMINE IF THE TERMINAL OPERATOR *** *** ENTERED DATA IN THE DEPT-ID-0410 FIELD ***
INQUIRE MAP SOLICIT
IF DFLD DEPT-ID-0410
DATA IS NO
GO TO A100-NO-DATA.
. *** FURTHER PROCESSING OF ENTERED DATA ***
Modifying Map Options
Before issuing an input or output request, you may need to modify a map's WCC options or specify attributes for one or more map data fields. You can make modifications either for the length of the session or for the next mapping operation. For example, you may need to:
  • Position the cursor on the next MAP OUT operation
  • Require that the user enter data in a specified map data field
  • Prevent the user from entering data in specified map data fields (this is especially useful on the initial MAP OUT of a session)
  • Require that data from a specified map data field be transmitted regardless of whether it was modified by the user
  • Modify the WCC and attribute options for an entire session
Steps to Modify a Map
To modify a map's WCC options or to specify attributes for one or more map data fields, perform the following steps:
  1. Issue mapping mode housekeeping statements
    For more information about housekeeping statements, see Housekeeping.
  2. Issue the MODIFY MAP command
  3. Issue either a MAP IN or MAP OUT statement
Example of Modifying a Map
The program excerpt below uses the MODIFY MAP statement to protect map data fields from operator input. The program is used in an application's initial MAP OUT to help ensure that the user will enter data in the correct field (EMP-ID-0415) by positioning the cursor and preventing input to all other map data fields.
PROCEDURE DIVISION. BIND MAP SOLICIT. BIND MAP SOLICIT RECORD EMPLOYEE. BIND MAP SOLICIT RECORD EMP-DATE-WORK-REC.
*** SET CURSOR AND PREVENT INPUT INTO ALL BUT EMP-ID-0415 ***
MODIFY MAP SOLICIT TEMPORARY
CURSOR AT DFLD EMP-ID-0415
FOR ALL EXCEPT DFLD EMP-ID-0415
ATTRIBUTES PROTECTED.
* MOVE ZERO TO EMP-ID-0415. MAP OUT USING SOLICIT YES NEWPAGE MESSAGE IS INITIAL-MESSAGE TO INITIAL-MESSAGE-END. * DC RETURN NEXT TASK CODE TSK02.
Writing and Reading in One Step
To write data to the terminal and read data input from the terminal in one synchronous operation, issue a MAP OUTIN statement.
MAP OUTIN forces your program to be conversational; it is not recommended.
If your application needs to write and read in one step, perform the following steps:
  1. Issue mapping mode housekeeping statements
    For more information about housekeeping statements, see Housekeeping.
  2. Modify map or map data fields,
    For more information about modifying map data fields, see Modifying Map Options.
  3. Initialize variable-storage data fields as needed
  4. Transfer data from variable-storage data fields to map fields on the terminal screen and back again by issuing the MAP OUTIN statement
Suppressing Map Error Messages
You can suppress the display of error messages for map fields. For example, you can code a data validation test so that it suppresses a map field's default error message and displays a different message when the field is in error.
What to Do
Include the ERROR MESSAGE IS ACTIVE/SUPPRESS parameter on your MODIFY MAP statement. ERROR MESSAGE immediately follows the REQUIRED/OPTIONAL parameter.
Example of Suppressing Error Messages
This COBOL example issues a MODIFY MAP statement that suppresses the display of default error messages for the ORDER-AMOUNT field on the current map.
In this application, the data validation routine compares the ORDER-AMOUNT field with the number of widgets on hand. If the current stock restricts the size of ORDER-AMOUNT, an alternative message is displayed.
  1. Define an alternative message in working storage. For example:
    DATA DIVISION. WORKING-STORAGE SECTION. 01 MESSAGES. 05 INITIAL-MESSAGE PIC X(80) VALUE 'ENTER A NUMERIC ORDER-AMOUNT AND PRESS ENTER'. 05 EDIT-ERROR-MESSAGE PIC X(80) VALUE 'ORDER-AMOUNT EITHER NOT ENTERED OR NOT NUMERIC'. 05 INVENTORY-MESSAGE PIC X(80) VALUE 'NOT ENOUGH WIDGETS IN STOCK TO DELIVER THAT AMOUNT'. 05 DISPLAY-MESSAGE PIC X(80) VALUE 'CLEAR TO EXIT ** ENTER ORDER-AMOUNT AND ENTER TO CONTINUE'
  2. Modify the map to display alternative messages when a specific error is found:
    MODIFY MAP MAP01 TEMPORARY FOR DFLD ORDER-AMOUNT ERROR MESSAGE IS SUPPRESS.
  3. Perform your data validation routine. For example, you can compare the number of widgets in stock to ORDER-AMOUNT. If ORDER-AMOUNT is greater than the number in stock, issue an alternative message indicating that the order cannot be filled.
    If the data validation routine indicates that there are not enough widgets in stock, display the map with the alternative message.
TEMPORARY and PERMANENT Options
The use of the SUPPRESS option is affected by the TEMPORARY/PERMANENT option:
  • If TEMPORARY is specified, error messages are suppressed for the next mapout only.
  • If PERMANENT is specified, error messages are suppressed until the program terminates or until the error message specifications are overridden by a subsequent MODIFY MAP statement.
Testing for Identical Data
You can compare the contents of a mapped-in field with the map data that is currently in your program's record buffer.
This means that you can test whether a map field contains the same data that was previously mapped out. By comparing the fields, your program updates the database only when the user enters different data, reducing the number of database I/O operations.
How this Relates to MDT Settings
The input test condition does not test a field's modified data tag (MDT). For example, the statement INQUIRE MAP MAP01 DATA IS IDENTICAL is
true
in either of the following cases:
  • The field's MDT is off. On mapin, the MDT is usually off if the user did not type any characters in the field.
  • The field's MDT is on, but each character that the user typed in is identical (including capitalization) to the data in variable storage.
What to Do
Include the IDENTICAL/DIFFERENT parameter in your INQUIRE MAP statement.
Example of Testing for Identical Data
This COBOL example uses an INQUIRE MAP statement to test whether the user has entered an employee ID number:
  • If the IDENTICAL condition is
    true
    (the user doesn't specify a different ID number), the program displays the menu screen
  • If the IDENTICAL condition is
    false
    (the user specifies a different ID number), the program obtains the corresponding employee record from the database
The sample INQUIRE MAP statement is shown below:
INQUIRE MAP MAP01 IF DFLD EMP-ID-0415 DATA IS IDENTICAL THEN PERFORM EMP-PROMPT-20 ELSE PERFORM EMP-OBTAIN-20.
Example of Testing for Changed Data
This COBOL example uses an INQUIRE MAP statement to test whether the user has entered a new department ID or department name. If the user has changed either value (DIFFERENT is
true
), the program branches to DEPTUP-30.
INQUIRE MAP MAP02 IF ANY DFLD DEPT-ID-0410 DFLD DEPT-NAME-0410 DATA IS DIFFERENT THEN PERFORM DEPTUP-30.