ILE COBOL Language Reference

+-------------------------------IBM Extension--------------------------------+

NULL-KEY-MAP IS Phrase

Specifies

the null key map of the record for the START operation according to the value specified for identifier-2. Identifier-2 must be a boolean or alphanumeric item.

Identifier-2 can be subscripted or reference modified.

If the file has alternate keys, identifier-2 is associated with the null key map of the current key of reference.

This phrase can only be specified for a file with the ALWNULL attribute and a device type of DATABASE specified in the ASSIGN clause. If one of the key fields is null-capable and the NULL-KEY-MAP phrase is not used, a null-key-map with all boolean zeroes is used.

Example of NULL-KEY-MAP IS Phrase

In this example, the following values represent the key in a file, which contains 3 fields of 2 bytes each. The key is defined by the following code in the File Section:

INPUT-OUTPUT SECTION.
FILE-CONTROL.
    SELECT FILE-1 ASSIGN to DATABASE-FILE1-ALWNULL
    ACCESS is DYNAMIC RECORD KEY IS FULL-PRODUCT-CODE IN FILE-1
    ORGANIZATION IS INDEXED.
FD FILE-1.
01 FULL-PRODUCT-CODE.
   05 TYPE-CODE      PIC X(2).
   05 COLOR-CODE     PIC X(2).
   05 LOCATION-CODE  PIC X(2).
WORKING-STORAGE SECTION.
01 FILE1-N.
   05 FULL-PRODUCT-CODE-NKM.
      06 FILLER             PIC X VALUE ZERO.
      06 COLOR-CODE-NF      PIC 1 VALUE B"0".
      06 LOCATION-CODE-NF   PIC 1 VALUE B"0".

Fields 2 and 3 are null-capable, where &nexists. indicates null, and xx indicates any value. The following are representations of the records in the file:

NN&nexists.&nexists.&nexists.&nexists.
NN&nexists.&nexists.xx
NNxx&nexists.&nexists.

Consider the following START statement:

  START FILE-1
      NULL-KEY-MAP IS FULL-PRODUCT-CODE-NKM
      INVALID KEY DISPLAY "No data in system for product code " TYPE-CODE
      GO TO ERROR-ROUTINE
      END-START. 

If the null-key-map in the START statement has a value of 010, the pointer is set to point to the record with the key NN&nexists.&nexists.xx. If the null-key-map in the START statement has a value of 011, the pointer is set to point to the record with the key NN&nexists.&nexists.&nexists.&nexists..

For more information about using null-capable fields, refer to the ILE COBOL for AS/400 Programmer's Guide.

+----------------------------End of IBM Extension----------------------------+


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]