Compaq COBOL
Reference Manual
5.3.5 Report Group Description
Function
The report group description entry specifies the characteristics of a 
report group and of the individual items within a report group.
Syntax Rules
All Formats
  - The report group description entry can appear only in the Report 
  Section.
  
 - Except for the group-data-name clause, which when present 
  must immediately follow level-number, the clauses may be in 
  any sequence.
  
 - The description of a report group may consist of one, two, or three 
  hierarchical levels:
  
    - The first entry that describes a report group must be a Format 1 
    entry.
    
 - Both Format 2 and Format 3 entries may be immediately subordinate 
    to a Format 1 entry.
    
 - At least one Format 3 entry must be immediately subordinate to a 
    Format 2 entry.
    
 - Format 3 entries must define elementary data items.
  
 
   - In the Report Section, the USAGE clause is used only to declare the 
  usage of printable items.
  
    - If the USAGE clause appears in a Format 1 or Format 2 entry, at 
    least one subordinate entry must define a printable item.
    
 - In Format 3, the USAGE clause must define a printable item.
  
 
   - An entry containing a LINE NUMBER clause must not have a 
  subordinate entry that also contains a LINE NUMBER clause.
 
Format 1
  - group-data-name is required only when:
  
    - A GENERATE statement references a DETAIL report group.
    
 - An UPON phrase of a SUM clause references a DETAIL report group.
    
 - A USE BEFORE REPORTING sentence references a DETAIL report group.
    
 - The name of a CONTROL FOOTING report group qualifies a reference to 
    a sum counter.
  
 
    
If specified, group-data-name can be used as a sum counter 
    qualifier and can be referenced only by:
  
    - GENERATE statements
    
 - UPON phrases of the SUM clause
    
 - USE BEFORE REPORTING declaratives
  
 
 
Format 2
  - level-number can be any integer from 02 to 48 inclusive.
  
 - A Format 2 entry must contain at least one optional clause.
  
 - In a Format 2 entry, group-data-name is optional. It can 
  only qualify a sum counter reference.
 
Format 3
  - level-number can be any integer from 02 to 49 inclusive.
  
 - A GROUP INDICATE clause can appear only in a DETAIL report group.
  
 - A SUM clause can appear only in a CONTROL FOOTING report group.
  
 - An entry containing a COLUMN NUMBER clause but no LINE NUMBER 
  clause must be subordinate to an entry containing a LINE NUMBER clause.
  
 - group-data-name is optional but can be specified in any 
  entry. group-data-name can be referenced only if the entry 
  defines a sum counter.
  
 - A LINE NUMBER clause must not be the only clause specified. Refer 
  to Syntax Rule 3d.
  
 - An entry containing a VALUE clause must also have a COLUMN NUMBER 
  clause.
  
 - A printable item is a data item whose size and content are 
  specified by an elementary report entry.
  
 - An elementary report entry contains a COLUMN NUMBER clause, a 
  PICTURE clause, and a SOURCE, SUM, or VALUE clause.
  
 - Figure 5-7 shows all permissible clause combinations for Format 
  3. You read the table from left to right along the selected row.
 
Figure 5-7 Format 3 Clause Combinations
General Rules
  - Format 1 is the Report Group entry. The report group is defined by 
  the contents of this entry and all of its subordinate entries.
  
 - The BLANK WHEN ZERO clause, the JUSTIFIED clause, and the PICTURE 
  clause for Report Writer are the same as those in the Data Description 
  Section.
 
Examples
The Compaq COBOL User Manual contains examples of each report group description 
entry format.
5.3.6 Screen Description (Alpha)
Function
A screen description entry describes a video form or a portion of a 
video form and specifies the attributes, behavior, size, and location 
of screen items within the video form. The screen description entry is 
referenced in the Procedure Division by the ACCEPT and DISPLAY 
statements.
Syntax Rules
All Formats
  - level-number can be any number from 01 to 49.
  
 - Each elementary screen description entry must contain at least one 
  of the following clauses:
  
    BELL
    
BLANK
    
COLUMN
    
LINE
    
PICTURE
    
VALUE
  
   - If the FOREGROUND-COLOR, BACKGROUND-COLOR, or SIGN clauses are 
  specified in both the group screen description entry and the 
  subordinate description entry for a screen item, then the subordinate 
  screen description entry's clauses will take effect.
  
 - screen-name assigns a name to the screen item described in 
  the screen description entry and must conform to the rules for 
  user-defined names. If either the optional screen-name or the 
  key word FILLER is specified, it must be the first word following the 
  level number in each screen description entry.
  
 - If both screen-name and FILLER are omitted, the screen 
  item being described is treated as though FILLER had been specified, 
  and cannot be referenced in an ACCEPT or DISPLAY statement.
  
 - Each level 01 item must have a screen name.
  
 - A screen item can be referenced only in an ACCEPT or DISPLAY 
  statement.
  
 - color-num-1 and color-num-2 are integers in the 
  range 0--7. color-num-1 and color-num-2 represent 
  specific colors as described in Table 5-5: 
  Table 5-5 Color Table
  
    | Color  | 
    Color Value  | 
    Color  | 
    Color Value  | 
  
  
    | 
      Black
     | 
    
      0
     | 
    
      Red
     | 
    
      4
     | 
  
  
    | 
      Blue
     | 
    
      1
     | 
    
      Magenta
     | 
    
      5
     | 
  
  
    | 
      Green
     | 
    
      2
     | 
    
      Yellow/Brown
     | 
    
      6
     | 
  
  
    | 
      Cyan
     | 
    
      3
     | 
    
      White
     | 
    
      7
     | 
  
   - The USING phrase is equivalent to the combination of FROM and TO 
  phrases, each specifying the same identifier.
  
 - identifier-3, identifier-4 and 
  identifier-5 must be defined in the File, Working-Storage, or 
  Linkage Section.
  
 - identifier-1 and identifier-2 must be described 
  as elementary unsigned numeric integer data items.
  
 - literal-1 must be a nonnumeric literal.
  
 - For a description of picture-string-1, see the 
  Section 5.3.37 Clause section of this chapter.
 
General Rules
All Formats
  - An input screen item is one whose description contains a TO clause.
  
 - An output screen item is one whose description contains a FROM 
  clause.
  
 - A literal screen item is one whose description contains a VALUE 
  clause.
  
 - An update screen item is one whose description contains a USING 
  clause.
  
 - An input-output screen item is one whose description contains both 
  a FROM phrase and a TO phrase that may or may not reference the same 
  identifier. The rules for update screen items also apply to 
  input-output screen items.
  
 - The LINE and COLUMN clauses should not be specified within a screen 
  description entry in such a way that fields overlap on the screen or 
  fall beyond the screen boundaries.
 
Format 1
  - Format 1 is used for group screen items.
  
 - All clauses within a group screen description entry are inherited 
  by subordinate screen description entries with the exception of the 
  BLANK SCREEN clause.
  
 - If the SECURE clause is specified, it applies to each subordinate 
  input screen item.
  
 - If the AUTO, FULL, or REQUIRED clauses are specified, they apply to 
  each subordinate input and update screen item.
  
 - If the BACKGROUND-COLOR, FOREGROUND-COLOR, or SIGN clauses are 
  specified, they apply to each subordinate input, output, and update 
  screen item.
 
Format 2
  - Format 2 is used to describe a literal screen item.
 
Format 3
  - Format 3 is used to describe input, output, or update screen items. 
  <>
 
5.3.7 ACCESS MODE
Function
The ACCESS MODE clause specifies the order of access for a file's 
records.
rel-key
is the file's RELATIVE KEY data item.
Syntax Rules
  - rel-key must be the data-name of an unsigned 
  integer data item whose description does not contain a PICTURE symbol 
  (P). It can be qualified but cannot be in a record description entry 
  for the same file-name.
  
 - The ACCESS MODE clause can be in the file's SELECT clause. However, 
  it cannot be in both the SELECT clause and file description entry for 
  the same file.
  
 - If the USING or GIVING phrases of a SORT or MERGE statement contain 
  the name of the file, the ACCESS MODE RANDOM clause cannot be used for 
  the file.
  
 - If rel-key is associated with an external file connector, 
  rel-key must reference the same data item in every program in 
  the run unit.
  
 - If a START statement references a relative file, the program must 
  specify the RELATIVE KEY phrase for that file.
 
General Rules
All Formats
  - If there is no ACCESS MODE clause, the access mode is sequential.
  
 - For sequential access, the sequence in which the program accesses 
  the records depends on the organization of the file, as follows:
  
    - Sequential files---The sequence is the same as that established by 
    the execution of WRITE statements that created or extended the file.
    
 - Relative files---The sequence is the order of ascending relative 
    record numbers of the file's existing records.
    
 - Indexed files---The sequence is the sort order (ascending or 
    descending) of record key values in the established Key of Reference.
  
 
 
Formats 2 and 3
  - For random access, the value of rel-key (for relative 
  files) or a Record Key data item (for indexed files) indicates the 
  record to be accessed.
  
 - For dynamic access, the program can access records sequentially and 
  randomly.
 
Format 2
  - Relative record numbers uniquely identify records in relative 
  files. A record's relative record number identifies its ordinal 
  position in the file. The first record in the file has a relative 
  record number of 1. Subsequent records have consecutively higher 
  relative record numbers.
  
 - The Relative Key data item associated with the execution of an 
  Input/Output statement is rel-key in the file description 
  entry (or SELECT clause) associated with the statement.
 
5.3.8 ALTERNATE RECORD KEY
Function
The ALTERNATE RECORD KEY clause specifies an alternate access path to 
indexed file records.
General Format
alt-key
is the Record Key for the file. It is the data-name of a data item in a 
record description entry for the file. It can be qualified, but it 
cannot be a group item that contains a variable-occurrence data item. 
The data item must be described as one of the following:
  - Alphanumeric item
  
 - Alphabetic item
  
 - Group item
  
 - Unsigned numeric display item
  
 -  COMP-3 integer
  
 -  COMP integer
 
seg-key
is a segmented-key name that represents the concatenation of one or 
more (up to eight) occurrences of seg.
seg
is the data-name of a data item in a record description entry for the 
file. It can be qualified, but it cannot be a group item that contains 
a variable-occurrence data item. The data item must be described as one 
of the following:
  -  Alphanumeric item
  
 - Alphabetic item
  
 -  Group item
  
 -  Unsigned numeric display item
 
Syntax Rules
  - The ALTERNATE RECORD KEY clause can be in the file's SELECT clause. 
  However, for the same file, it cannot be in both the SELECT clause and 
  file description entry.
  
 - alt-key or the segments of seg-key cannot have 
  the same leftmost character position as that of the Prime Record Key 
  data item or any other alt-key or segment of seg-key 
  for the same file.
 
General Rules
  -  seg-key is the concatenation of all specified key 
  segments in the order specified.
  
 -  seg-key can be referenced only in a READ (Format 3) or 
  START statement.
  
 - When a program creates an indexed file with one or more ALTERNATE 
  RECORD KEY clauses, each subsequent program referencing this indexed 
  file must:
  
    - Use the same data description for alt-key or the segments 
    of seg-key.
    
 - Define the same relative location in the record as alt-key 
    or the segments of seg-key.
    
 - Specify the same number (or less) of ALTERNATE RECORD KEY clauses. 
    
On Tru64 UNIX systems, you can specify a different number of 
    keys than was specified when the file was created, if the relaxed key 
    check option (
-relax_key_checking
) is used. <>
     - Maintain the same order of ALTERNATE RECORD KEY clauses.
    
 - Specify the same order of keys (ASCENDING or DESCENDING) in each 
    ALTERNATE RECORD KEY clause as the order used when the file was created.
  
 
   - The DUPLICATES phrase specifies that two or more records in the 
  file can have duplicate values in the same alt-key or the 
  segments of seg-key. If there is no DUPLICATES phrase, two 
  records cannot have the same value in corresponding Alternate Record 
  Keys.
    
On OpenVMS, if the program was compiled with the 
    /CHECK=DUPLICATE_KEYS qualifier on the command line, and the duplicate 
    key specification on a file's FD (in other words, specified in the WITH 
    DUPLICATES phrase) does not match that of the actual file, a run-time 
    diagnostic will be issued when an attempt is made to open the file with 
    an OPEN statement. 
The /CHECK=DUPLICATE_KEYS qualifier is not 
    supported for remotely accessed files. Duplicate keys, key length, and 
    number of keys are not checked for remote files, that is, files 
    accessed over the network. <> 
On Tru64 UNIX systems, 
    DUPLICATES must match the specification for DUPLICATES when the file 
    was created, unless the relaxed key check option is used. <>
   -  If a file has more than one record description entry, only one of 
  these record description entries must describe alt-key or the 
  segments of seg-key. The character positions referenced by 
  alt-key or the segments of seg-key in that record 
  description are implicitly referenced in all other record description 
  entries for the file.
  
 - A file can have up to 254 Alternate Record Keys.
  
 - If the associated file connector is an external file connector, all 
  File Description entries in the run unit that are associated with the 
  file connector must define the same data description entry for 
  alt-key or the segments of seg-key, with the same 
  relative location within the record.
  
 - Each key can be specified as ASCENDING or DESCENDING (ASCENDING is 
  the default). In an ASCENDING key, lower key values occur toward the 
  beginning of the sorted file. In a DESCENDING key, higher key values 
  occur toward the beginning of the sorted file.
 
Additional Reference
5.3.9 AUTO
Function
In the context of ACCEPT, the AUTO clause moves the cursor to the next 
field when the last character of an input or update field that was 
defined with the AUTO clause is entered.
Syntax Rule
The AUTO clause cannot be specified in the description of a literal 
screen item.
General Rules
  - If the AUTO clause is specified at group level, it applies to each 
  input and update screen item in that group.
  
 - The AUTO clause is significant in the context of an ACCEPT.
  
 - The AUTO clause is ignored in the description of an output screen 
  item.
  
 - If there is only one field to input, or if the field is the last 
  one of the screen, the ACCEPT statement is completed when the last 
  character of the field is entered.
 
Additional Reference
Section 6.8.1 statement in Chapter 6
5.3.10 BACKGROUND-COLOR (Alpha)
Function
The BACKGROUND-COLOR clause specifies the background color for the 
screen item.
color-num
is an integer in the range 0--7 specifying a color as follows:
  
    | Color  | 
    Color Value  | 
    Color  | 
    Color Value  | 
  
  
    | 
      Black
     | 
    
      0
     | 
    
      Red
     | 
    
      4
     | 
  
  
    | 
      Blue
     | 
    
      1
     | 
    
      Magenta
     | 
    
      5
     | 
  
  
    | 
      Green
     | 
    
      2
     | 
    
      Yellow/Brown
     | 
    
      6
     | 
  
  
    | 
      Cyan
     | 
    
      3
     | 
    
      White
     | 
    
      7
     | 
  
Syntax Rule
The BACKGROUND-COLOR clause can be specified in any screen description 
entry.
General Rules
  - The BACKGROUND-COLOR clause is effective only with color screens.
  
 - If the BACKGROUND-COLOR clause is omitted, the initial default 
  background color is black.
  
 - If the clause is specified at group level, it applies to all 
  subordinate screen items.
  
 -  If the BLANK SCREEN clause is specified and the BACKGROUND-COLOR 
  clause is specified or inherited, then when a DISPLAY statement 
  displays the screen item, the specified color becomes the default 
  background color. It remains the default background color until another 
  screen item with this combination of options is displayed (whether in 
  the same DISPLAY statement or in another).
 
Technical Note
The colors in the list above are supported only on terminals and 
workstations that support the ANSI Standard color sequences. 
1
Additional References
5.3.11 BELL
Function
The BELL clause sounds the workstation or terminal audio tone.
Syntax Rule
The BELL clause can be specified only for elementary screen description 
entries.
General Rule
The audio tone sounds when a DISPLAY statement displays a screen item 
whose description contains a BELL clause.
Additional Reference
Section 6.8.10 statement in Chapter 6
5.3.12 BLANK
Function
The BLANK clause clears a screen line or clears the whole screen before 
displaying the screen item.
Syntax Rules
  - The BLANK SCREEN clause can be specified for any screen description 
  entry.
  
 - The BLANK LINE clause can be specified only for elementary screen 
  description entries.
 
General Rules
  - The BLANK SCREEN clause executes before a screen item displays, no 
  matter where it appears in the screen item's description. When the 
  BLANK SCREEN clause is specified, the screen is cleared and the cursor 
  is placed at line 1, column 1.
  
 - When BLANK LINE is specified in an elementary screen item's 
  description, blanking begins at column 1 of the specified line and 
  continues through to the end of the line.
  
 - If neither the BLANK clause nor the ERASE clause (Alpha) is 
  specified, only the particular character positions corresponding to the 
  screen item are modified when the item is displayed. The remainder of 
  the screen content is not changed.
  
 - The BLANK SCREEN clause returns the screen to the initial defaults 
  for background and foreground color if the BACKGROUND-COLOR and 
  FOREGROUND-COLOR clauses are not specified, respectively.
  
 - The BLANK clause is ignored in an ACCEPT statement.
 
Additional Reference
Section 6.8.10 statement in Chapter 6
  
    
      Note 
         
        
        1  This does not include the 
        VT100, VT200, VT300, and VT400 series terminals. On workstations that 
        emulate these terminal types, this restriction may not apply.
    
     |