Previous Topic: Suppressing Map Error MessagesNext Topic: Using Pageable Maps


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:

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:

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.