COBOL/400 Language Help

Format 4 (Boolean Data)

Description
The Data Description Entry Format 4 (Boolean Data) describes the indicators you use in a COBOL program as Boolean data items. Boolean data items are items limited to a value of 1 or 0.
Format 4 (Boolean Data)
 
->->---level-number--*---------------*--*--------------------------*---->
                   *--data-name-1--*  *--REDEFINES--data-name-2--*
                   *--FILLER-------*  *--LIKE--data-name-3-------*
 
 ->----*---------------------------*----------------------------------->
      *--*--PICTURE--*-*----*--1--*
         *--PIC------* *-IS-*
 
 ->----*------------------------------*-------------------------------->
      *--*---------------*--DISPLAY--*
         *--USAGE-*----*-*
                  *-IS-*
 
 ->--*-----------------------------------------------------------------> 1
    *-OCCURS-*-integer-1 TO integer-2-*-------*-----------------------> 2
             +                        *-TIMES-*
             *-integer-2-*-------*------------------------------------> 3
                         *-TIMES-*
 
1 ->-------------------------------------------------------------------> 4
2 ->---DEPENDING--*----*--data-name-4---*------------------------------> 5
                 *-ON-*                +
3 ->------------------------------------*
 
4 ->---------------------------------------------*--------------------->
5 ->---*--------------------------------------*--*
      +                     *-------------*  +
      +                     V             +  +
      *--INDEXED--*----*----index-name-1--*--*
                  *-BY-*
 
 ->----*---------------------------*----------------------------------->
      *-*-INDICATOR--*--integer-3-*
        *-INDICATORS-*
        *-INDIC------*
 
 ->----*-----------------------------------*--------------------------->
      *--*--SYNCHRONIZED--*--*---------*--*
         *--SYNC----------*  *--LEFT---*
                             *--RIGHT--*
 
 ->----*----------------------------*---------------------------------->
      *--*-JUSTIFIED-*--*-------*--*
         *-JUST------*  *-RIGHT-*
 
 ->----*---------------------------------*--.--------------------------><-
      *--VALUE-*----*--boolean-literal--*
               *-IS-*
 

data-name-1

Data-name-1 explicitly identifies the data being described. If you specify data-name-1, it identifies a data item used in the program. If specified, data-name-1 must be the first word following the level-number.

FILLER

FILLER is a data item that is not explicitly referred to in a program. If you specify FILLER (an optional keyword), it must be the first word following the level-number.

If you omit data-name-1 or the keyword FILLER, the data item being described is treated as though FILLER had been specified.

PICTURE

A PICTURE containing a single 1 defines an elementary Boolean data-name.

1

A single 1 is a character position that contains a Boolean value of B"1" or B"0". Usage must be explicitly or implicitly defined as DISPLAY.

DISPLAY or USAGE

USAGE must be defined implicitly or explicitly as DISPLAY.

OCCURS Clause

Description
The OCCURS clause specifies tables whose elements can be referred to by indexing or subscripting. The OCCURS and USAGE IS INDEX clauses are the two Data Division clauses used for table handling.

An item whose usage is POINTER can contain an OCCURS clause, or be subordinate to an item declared with an OCCURS clause.

The OCCURS clause cannot be specified in a data description entry that has a level number of 01, 66, 77, or 88.

When the OCCURS clause and the INDICATOR clause are both specified at an elementary level, a table of Boolean data items is defined with each element in the table corresponding to an external indicator. The first element in the table corresponds to the indicator number specified in the INDICATOR clause; the second element corresponds to the indicator that sequentially follows the indicator specified by the INDICATOR clause. For example, if you code:

       07  SWITCHES  PIC 1
                     OCCURS 10 TIMES
                     INDICATOR 16.
 

SWITCHES (1) corresponds to indicator 16, SWITCHES (2) corresponds to indicator 17, and similarly, SWITCHES (10) corresponds to indicator 25.

data-name-4

Data-name-4 specifies the object of the OCCURS DEPENDING ON clause, that is, the data item whose current value represents the current number of occurrences of the subject item.

INDICATOR

If indicator fields are in a separate indicator area, the INDICATOR clause associates an indicator defined in DDS with a Boolean data item.

If indicator fields are in the record area, the INDICATOR clause is syntax-checked, but is treated as documentation.

You must specify the INDICATOR clause at an elementary level only. INDICATOR, INDICATORS, and INDIC are equivalent.

integer-3

Integer-3 must be a value of 1 through 99.

VALUE

The VALUE clause specifies the initial content of a Boolean data item.

boolean-literal

The allowable values for Boolean literals are B"0", B"1", and ZERO.


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