Compaq COBOL
Reference Manual


Previous Contents Index

5.3.49 SYNCHRONIZED

Function

The SYNCHRONIZED clause specifies elementary item alignment on word boundary offsets relative to a record's beginning. These offsets are related to the size and usage of the item being stored.


Syntax Rules

  1. SYNC is an abbreviation for SYNCHRONIZED.
  2. The SYNCHRONIZED clause can be used only for an elementary item.

General Rules

  1. The SYNCHRONIZED clause aligns a data item in a record so that no other data item occupies any character positions between the required boundaries to the left and right of the data item.
  2. If the number of character positions needed to store the data item is less than the number of positions between the required boundaries, no other data items occupy the unused positions.
    However, the unused character positions are included in the size of those group items:
    The first elementary item in a group item always aligns on the same boundary as the group item. In this case, any unused character positions do not affect the size of that group item.
  3. The size of a SYNCHRONIZED data item equals the number of character positions between its natural boundaries. Therefore, the LEFT and RIGHT phrases have the same effect; they are equivalent to each other, and to the SYNCHRONIZED clause with neither the LEFT nor RIGHT phrases.
  4. The SYNCHRONIZED clause does not change the size or operational sign position of the data item it specifies.
  5. Each occurrence of the data item is synchronized if the clause applies to a data item whose data description entry also has an OCCURS clause, or to a data item subordinate to another data item whose data description entry has an OCCURS clause.

Technical Notes

Additional Reference

Section 5.2.3, Additional Alignment Rules for Record Allocation

5.3.50 TYPE

Function

The TYPE clause identifies the report group type and indicates when the Report Writer Control System (RWCS) is to process it.


control-head-name

names a control-name in the CONTROL clause.

control-foot-name

names a control-name in the CONTROL clause.

Syntax Rules

  1. RH is an abbreviation for REPORT HEADING.
    PH is an abbreviation for PAGE HEADING.
    CH is an abbreviation for CONTROL HEADING.
    DE is an abbreviation for DETAIL.
    CF is an abbreviation for CONTROL FOOTING.
    PF is an abbreviation for PAGE FOOTING.
    RF is an abbreviation for REPORT FOOTING.
  2. These report groups may appear no more than once in the description of a report:
  3. The TYPE DETAIL report group may appear more than once in the description of a report.
  4. If the TYPE clause specifies a CONTROL HEADING or CONTROL FOOTING report group, the control-head-name, control-foot-name, or FINAL entries must be specified in the CONTROL clause of the corresponding Report Description entry. For each control-name or FINAL phrase in the CONTROL clause of a Report Description entry, you can specify one CONTROL HEADING report group and one CONTROL FOOTING report group. However, the RWCS does not require either a CONTROL HEADING report group or a CONTROL FOOTING report group for each control-name or FINAL phrase in the CONTROL clause of a Report Description.
  5. PAGE HEADING and PAGE FOOTING report groups may appear only if the corresponding Report Description entry specifies a PAGE clause.
  6. In CONTROL FOOTING, PAGE HEADING, PAGE FOOTING, and REPORT FOOTING report groups, SOURCE clauses and USE statements must not reference any of the following:
  7. In PAGE HEADING and PAGE FOOTING report groups, SOURCE clauses and USE statements must not reference either control-head-name or control-foot-name.
  8. When the Procedure Division specifies a GENERATE report-name statement, the corresponding Report Description entry must define no more than one DETAIL report group. If there are no GENERATE group-data-name statements in the Procedure Division, the RWCS does not require a DETAIL report group. If there are multiple TYPE DETAIL report groups in the report, the GENERATE group-data-name statement must be used.

General Rules

  1. The Report Writer Control System (RWCS) processes DETAIL report groups as a direct result of the GENERATE statement. If a report group specified in the GENERATE statement is not a TYPE DETAIL report group, a summary report is produced. If a report group specified in the GENERATE statement is a TYPE DETAIL report group, a detailed report is produced.
  2. The RWCS executes the following procedures (a to f) when it processes a DETAIL report group in response to a GENERATE statement.
    When the description of a report includes exactly one DETAIL report group, the detail-related processing that the RWCS executes in response to a GENERATE report-name statement is described in procedures a to d. The RWCS performs these procedures as though a GENERATE group-data-name statement were being executed.
    When the description of a report includes no DETAIL report groups, the detail-related processing that the RWCS executes in response to a GENERATE report-name statement is described in procedures a and b. These procedures are performed as though the description of the report included exactly one DETAIL report group, and a GENERATE detail-report-group statement were being executed.
    1. The RWCS performs any control break processing.
    2. The RWCS performs any subtotalling that has been designated for the DETAIL report group.
    3. If there is a USE BEFORE REPORTING procedure referring to the data-name of the report group, the RWCS executes the USE procedure.
    4. If a SUPPRESS statement has been executed, or if the report group is not printable, no further processing is done for the report group.
    5. If the RWCS processes a DETAIL report group as a consequence of the GENERATE report-name statement, no further processing is done for the report group.
    6. If neither procedure d nor procedure e applies, the RWCS formats the print lines and presents the DETAIL report group.
  3. To detect and trigger control breaks for a specific report, the RWCS:
    1. Establishes the initial values of control data items as the prior values when the INITIATE statement executes.
    2. Compares the prior values to the current values of control data items when a GENERATE statement executes. If the current values do not compare to the prior values, a control break occurs. If a control break occurs, the current values are saved as prior values and steps c, d, and e are performed.
    3. Presents the CONTROL FOOTING and CONTROL HEADING report groups associated with the control break. The CONTROL FOOTING report groups presented are at a less major level than the level at which the control break occurred. The CONTROL HEADING report groups presented are in the order of major level to break level.
    4. Processes any PAGE HEADING and PAGE FOOTING report groups when it must start a new page to present a CONTROL HEADING, DETAIL, or CONTROL FOOTING.
    5. Repeats steps b, c, and d until the last control break is processed.
  4. The prior values (refer to General Rule 3) may be referenced by the program:
  5. The RWCS presents the REPORT HEADING report group only once for each report, as the first report group of that report. It is processed when the first GENERATE statement is executed.
  6. The RWCS presents the PAGE HEADING report group as the first report group on each page of the report, except for the following conditions:
  7. The RWCS processes the CONTROL HEADING report group at the end of a control break for a specific control-head-name.
    The CONTROL HEADING FINAL report group is presented only once for each report, as the first body group (CONTROL HEADING, DETAIL, and CONTROL FOOTING) of that report. Other CONTROL HEADING report groups are presented when the RWCS detects a control break on the control-head-name during the execution of GENERATE statements. Control break processing for any CONTROL HEADING report group occurs with the highest control level of the break and includes all lower levels.
  8. The RWCS presents CONTROL FOOTING report group at the beginning of a control break for a specific control-foot-name.
    The CONTROL FOOTING FINAL report group is presented only once for each report, as the last body group (CONTROL HEADING, DETAIL, and CONTROL FOOTING) of that report. If, during the execution of a GENERATE statement, the RWCS detects a control break, control break processing for any CONTROL FOOTING report group occurs with the highest control level of the break and includes all lower levels. Upon execution of the TERMINATE statement, the RWCS processes all CONTROL FOOTING report groups if the GENERATE statement has executed at least once.
  9. The RWCS processes the PAGE FOOTING report group as the last report group on each page of the report, except for the following conditions:
  10. The RWCS processes the REPORT FOOTING report group, if defined, only once per report and as the last report group of that report. During the execution of a TERMINATE statement, the RWCS processes the corresponding REPORT FOOTING report group if at least one GENERATE statement is executed for the report.
  11. The RWCS checks for these three conditions before it processes a REPORT HEADING, PAGE HEADING, CONTROL HEADING, PAGE FOOTING, or a REPORT FOOTING report group:
  12. The RWCS executes the following procedures when it processes a CONTROL FOOTING report group.
    Control breaks occur during the processing of a GENERATE statement. The GENERATE rules specify that the RWCS produces the CONTROL FOOTING report groups beginning at the minor level, and proceeding upwards, through and including the highest control level. Although no CONTROL FOOTING report group has been defined for a given control data-name, the RWCS will still have to execute procedure 12f if a RESET phrase within the report description specifies that control data-name.
    1. Sum counters are crossfooted. All sum counters defined in this report group that are operands of SUM clauses in the same report group are added to their sum counters.
    2. Sum counters are rolled forward. All sum counters defined in the report group that are operands of SUM clauses in higher level CONTROL FOOTING report groups are added to the higher level sum counters.
    3. If there is a USE BEFORE REPORTING group-data-name declarative procedure, the RWCS executes the USE procedure.
    4. If a SUPPRESS statement has been executed, or if the report group is not printable, the RWCS executes procedure 12f.
    5. If a suppress statement has not been executed and the report group is printable, the RWCS formats the print lines and presents the report group according to the presentation rules for CONTROL FOOTING report groups.
    6. The RWCS resets those sum counters that are to be reset when the RWCS processes this level in the control hierarchy.

Additional References

5.3.51 UNDERLINE

Function

The UNDERLINE clause specifies that each character of the field is underlined when it is displayed on the screen.


Syntax Rule

The UNDERLINE clause may be specified only for elementary screen items.

5.3.52 USAGE

Function

The USAGE clause specifies the internal format of a data item or screen item.


Syntax Rules

  1. BINARY is a synonym for COMPUTATIONAL and COMP.
    On Alpha systems, except for restrictions on the PICTURE clause, COMPUTATIONAL-5 and COMPUTATIONAL-X are synonyms for COMPUTATIONAL and COMP. <>
  2. COMP is an abbreviation for COMPUTATIONAL.
  3. COMP-1 is an abbreviation for COMPUTATIONAL-1.
  4. COMP-2 is an abbreviation for COMPUTATIONAL-2.
  5. COMP-3 is an abbreviation for COMPUTATIONAL-3.
  6. PACKED-DECIMAL is a synonym for COMPUTATIONAL-3 and COMP-3.
  7. On Alpha systems, COMP-5 is an abbreviation for COMPUTATIONAL-5.
  8. On Alpha systems, COMP-X is an abbreviation for COMPUTATIONAL-X.
  9. On Alpha systems, FLOAT-SHORT is a synonym for COMPUTATIONAL-1.
  10. On Alpha systems, FLOAT-LONG and FLOAT-EXTENDED are synonyms for COMPUTATIONAL-2. <>
  11. You can use the USAGE clause in any data description entry with a level-number other than 66 or 88.
  12. If the USAGE clause is in the data description for a group item, it can also be in data description entries for subordinate elementary and group items. However, the usage of a subordinate item must be the same as that in the group item data description entry.
  13. The PICTURE character-string of a COMP or COMP-3 item can contain only the following symbols:
  14. On Alpha systems, the PICTURE character-string of a COMP-5 or COMP-X item can contain only the following symbols:
  15. An index data item reference can appear in only:
  16. A report description entry or a screen description entry can only specify USAGE IS DISPLAY.
  17. The data description entry for a USAGE IS INDEX data item cannot contain any of the following clauses:
  18. An elementary item with the USAGE IS INDEX clause cannot be a conditional variable; that is, the elementary item's value cannot be specified by level 88 items.
  19. The data description entry of a BINARY-CHAR, BINARY-SHORT, BINARY-LONG, BINARY-DOUBLE, COMP-1, COMP-2, POINTER, or POINTER-64 item cannot have a PICTURE clause. However, they are numeric and signed.
  20. The subject of a data description entry containing the USAGE IS POINTER clause must not include any of the following clauses:

General Rules

  1. You can specify the USAGE clause in the data description entry for a group item. In this case, it applies to each elementary item in the group. However, you cannot reference the group item in any operations that do not permit alphanumeric operands. See rules 4 and 8 for more information.
  2. The USAGE clause specifies the representation of an elementary data item in storage. It does not affect the way that the program uses the item. However, the rules for some Procedure Division statements restrict the USAGE clause of statement operands.
  3. A BINARY-CHAR, BINARY-SHORT, BINARY-LONG, BINARY-DOUBLE, COMP, COMP-1, COMP-2, COMP-3, COMP-5, COMP-X, FLOAT-SHORT, FLOAT-LONG, or FLOAT-EXTENDED item can represent a value used in computations. The PICTURE clauses for COMP and COMP-3 items must be numeric. The PICTURE clauses for COMP-5 and COMP-X items may be numeric or X.
  4. A POINTER data item can represent an address value used in computations. The compiler internally treats this item as a binary integer. References to a POINTER item are allowed in the same context as references to a COMP integer.
  5. If the data description entry for a group item specifies BINARY-CHAR, BINARY-SHORT, BINARY-LONG, BINARY-DOUBLE, COMP, COMP-1, COMP-2, COMP-3, COMP-5, COMP-X, FLOAT-SHORT, FLOAT-LONG, FLOAT-EXTENDED, POINTER, or POINTER-64 usage, the usage applies to elementary items in the group. It does not apply to the group itself; and the program cannot use the group item in computations.
  6. The USAGE IS DISPLAY clause specifies that the data item is in Standard Data Format.
  7. If no USAGE clause applies to an elementary item, its usage is DISPLAY.
  8. If the USAGE IS INDEX clause applies to an elementary item, the elementary item is called an index data item. It contains a value that must correspond to an occurrence number of a table element.
  9. If the data description entry for a group item specifies USAGE IS INDEX, all elementary items in the group are index data items. However, the group itself is not an index data item.
  10. When a MOVE or input-output statement refers to a group that contains an index data item, the index data item is not converted to another format during the operation. Conversion will occur when the CONVERSION option is specified on ACCEPT or DISPLAY.
  11. The USAGE IS POINTER clause can be used only in a File, Working-Storage, or Linkage Section data description entry.
  12. On OpenVMS Alpha, the USAGE IS POINTER-64 clause is provided for limited use in interfacing with applications in languages requiring a 64-bit pointer. See Technical Notes. <>

Technical Notes

  1. The way a data item is represented in the Data Division of a COBOL program determines whether it will be stored as an integer, floating-point, packed decimal, display numeric, or character string (text) data type. Tables 5-12 and 5-13 show the following:
    Table 5-12 gives the corresponding data types for unscaled data items, and Table 5-13 gives the data types for scaled data items.
    For example, a data item described as PIC S9(4) USAGE IS DISPLAY SIGN IS TRAILING is stored in 4 bytes of storage as a right overpunch value.

    Note

    The default USAGE for a data item is DISPLAY. Therefore, you do not need to specify the USAGE clause for display numeric, alphabetic, and alphanumeric data items.

    Table 5-12 Unscaled Data Items, Allocated Storage, and Corresponding Data Types
    PICTURE
    Clause
    USAGE Clause SIGN Clause Allocated Storage
    in Bytes
    Standard
    Data Type
    PIC S9(n)
    [n <= 31
    (Alpha) or
    18 (VAX)]
    DISPLAY   n Right (trailing) overpunch
     
    PIC S9(n)
    [n <= 31
    (Alpha) or
    18 (VAX)]
    DISPLAY TRAILING n Right (trailing) overpunch
     
    PIC S9(n)
    [n <= 31
    (Alpha) or
    18 (VAX)]
    DISPLAY LEADING n Left (leading) overpunch
     
    PIC S9(n)
    [n <= 31
    (Alpha) or
    18 (VAX)]
    DISPLAY TRAILING
    SEPARATE
    n+1 Right (trailing) separate
     
    PIC S9(n)
    [n <= 31
    (Alpha) or
    18 (VAX)]
    DISPLAY LEADING
    SEPARATE
    n+1 Left (leading) separate
     
    PIC 9(n)
    [n <= 31
    (Alpha) or
    18 (VAX)]
    DISPLAY   n Unsigned numeric
     
    PIC 9(n)
    [n <= 4]
    COMP
    COMP-5 (Alpha)
    COMP-X (Alpha)
      2 Word integer 1
     
    PIC 9(n)
    [5 <= n <= 9]
    COMP
    COMP-5 (Alpha)
    COMP-X (Alpha)
      4 Longword integer 1
     
    PIC 9(n)
    [10 <= n <= 18]
    COMP
    COMP-5 (Alpha)
    COMP-X (Alpha)
      8 Quadword integer 1
     
    PIC 9(n)
    [19 <= n <= 31] (Alpha)
    COMP
    COMP-5
    COMP-X
      16 Octaword integer 1 (Alpha)
     
    PIC S9(n)
    [n <= 4]
    COMP
    COMP-5 (Alpha)
    COMP-X (Alpha)
      2 Word integer
     
    PIC S9(n)
    [5 <= n <= 9]
    COMP
    COMP-5 (Alpha)
    COMP-X (Alpha)
      4 Longword integer
     
    PIC S9(n)
    [10 <= n <= 18]
    COMP
    COMP-5 (Alpha)
    COMP-X (Alpha)
      8 Quadword integer
     
    PIC S9(n)
    [19 <= n <= 31] (Alpha)
    COMP
    COMP-5
    COMP-X
      16 Octaword integer (Alpha)
     
    PIC X(n)
    [n <= 2] (Alpha)
    COMP-5
    COMP-X
      2 Word integer 1 (Alpha)
     
    PIC X(n)
    [3 <= n <= 4] (Alpha)
    COMP-5
    COMP-X
      4 Longword integer 1 (Alpha)
     
    PIC X(n)
    [5 <= n <= 8] (Alpha)
    COMP-5
    COMP-X
      8 Quadword integer 1 (Alpha)
     
    Not applicable INDEX   4 Longword integer
     
    Not applicable POINTER   4 Longword integer (OpenVMS)
      POINTER   8 Quadword integer (Tru64 UNIX)
      POINTER-64 (Alpha)   8 Quadword integer (OpenVMS Alpha)
     
    Not applicable BINARY-CHAR UNSIGNED (Alpha)   2 Word integer 1 (Alpha)
     
    Not applicable BINARY-SHORT UNSIGNED (Alpha)   2 Word integer 1 (Alpha)
     
    Not applicable BINARY-LONG UNSIGNED (Alpha)   4 Longword integer 1 (Alpha)
     
    Not applicable BINARY-DOUBLE UNSIGNED (Alpha)   8 Quadword integer 1 (Alpha)
     
    Not applicable BINARY-CHAR SIGNED (Alpha)
    BINARY-CHAR (Alpha)
      2 Word integer (Alpha)
     
    Not applicable BINARY-SHORT SIGNED (Alpha)
    BINARY-SHORT (Alpha)
      2 Word integer (Alpha)
     
    Not applicable BINARY-LONG SIGNED (Alpha)
    BINARY-LONG (Alpha)
      4 Longword integer (Alpha)
     
    Not applicable BINARY-DOUBLE SIGNED (Alpha)
    BINARY-DOUBLE (Alpha)
      8 Quadword integer (Alpha)
     
    Not applicable COMP-1   4 F_floating
    S_format 2 (Alpha)
     
    Not applicable COMP-2   8 D_floating
    G_floating (Alpha)
    T_format 2 (Alpha)
     
    PIC 9(n)
    [n <= 31
    (Alpha) or
    18 (VAX)]
    COMP-3   (n+1)/2
    rounded up
    Packed decimal 1
     
    PIC S9(n)
    [n <= 31
    (Alpha) or
    18 (VAX)]
    COMP-3   (n+1)/2
    rounded up
    Packed decimal
     
    PIC X(n)
    [n <= 268,435,455]
    DISPLAY   n
    ASCII text
     
    PIC A(n)
    [n <= 268,435,455]
    DISPLAY   n
    ASCII text


    1The generated code treats this data type as a positive value in all contexts except when it is a receiving-field operand. In this case, the compiler stores the absolute value of the source data item.
    2On OpenVMS Alpha systems, the data type depends on the /FLOAT qualifier. On Tru64 UNIX systems, it is always S format for COMP-1, and always T format for COMP-2. Refer to the Compaq COBOL User Manual Appendix B, describing compatibility with Compaq COBOL for OpenVMS VAX for information on the /FLOAT=IEEE qualifier.


    Table 5-13 Scaled Data Items, Allocated Storage, and Data Types
    PICTURE
    Clause
    USAGE Clause SIGN Clause Allocated Storage
    in Bytes
    Standard
    Data Type
    PIC S9(n)V9(s)
    [(n+s) <= 31
    (Alpha) or
    18 (VAX)]
    DISPLAY   n+s Right (trailing)
    overpunch
     
    PIC S9(n)V9(s)
    [(n+s) <= 31
    (Alpha) or
    18 (VAX)]
    DISPLAY TRAILING n+s Right (trailing)
    overpunch
     
    PIC S9(n)V9(s)
    [(n+s) <= 31
    (Alpha) or
    18 (VAX)]
    DISPLAY LEADING n+s Left (leading)
    overpunch
     
    PIC S9(n)V9(s)
    [(n+s) <= 31
    (Alpha) or
    18 (VAX)]
    DISPLAY TRAILING
    SEPARATE
    n+s+1 Right (trailing)
    separate
     
    PIC S9(n)V9(s)
    [(n+s) <= 31
    (Alpha) or
    18 (VAX)]
    DISPLAY LEADING
    SEPARATE
    n+s+1 Left (leading)
    separate
     
    PIC 9(n)V9(s)
    [(n+s) <= 31
    (Alpha) or
    18 (VAX)]
    DISPLAY   n+s Unsigned numeric
     
    PIC 9(n)V9(s)
    [(n+s) <= 4]
    COMP   2 Word integer 1
     
    PIC 9(n)V9(s)
    [5 <= (n+s) <= 9]
    COMP   4 Longword integer 1
     
    PIC 9(n)V9(s)
    [10 <= (n+s) <= 18]
    COMP   8 Quadword integer 1
     
    PIC 9(n)V9(s)
    [19<= (n+s) <= 31] (Alpha)
    COMP   16 Octaword integer 1 (Alpha)
     
    PIC S9(n)V9(s)
    [(n+s) <= 4]
    COMP   2 Word integer
     
    PIC S9(n)V9(s)
    [5 <= (n+s) <= 9]
    COMP   4 Longword integer
     
    PIC S9(n)V9(s)
    [10 <= (n+s) <= 18]
    COMP   8 Quadword integer
     
    PIC S9(n)V9(s)
    [19 <= (n+s) <= 31]
    COMP   16 Octaword integer (Alpha)
     
    PIC 9(n)V9(s)
    [(n+s) <= 31
    (Alpha) or
    18 (VAX)]
    COMP-3   (n+s+1)/2
    rounded up
    Packed decimal 1
     
    PIC S9(n)V9(s)
    [(n+s) <= 31
    (Alpha) or
    18 (VAX)]
    COMP-3   (n+s+1)/2
    rounded up
    Packed decimal


    1The generated code treats this data type as a positive operand in all contexts except when it is a receiving-field operand. In this case, the compiler stores the absolute value of the data type.

  2. The OpenVMS Alpha operating system (as of Version 7.0) can dynamically allocate data in 64-bit address space. Compaq COBOL does not support data in 64-bit address space, but limited use of it may be made with the USAGE IS POINTER-64 clause on OpenVMS Alpha. You might need to describe a data item as USAGE IS POINTER-64 if your program interfaces with an application in another language that requires a 64-bit pointer. Then you would use the SET statement or a VALUE clause to assign the address of a static COBOL variable to the pointer variable. The pointer variable can be passed to a routine whose interface definition requires a 64-bit pointer.
    You can also use an appropriate system service or the Run-Time Library routine LIB$GET_VM_64 to allocate data and store the address in the pointer variable. Because COBOL does not support dynamic allocation, there is no way to dereference the pointer and access the allocated data. However, you can pass the pointer to other languages that require a 64-bit pointer in 64-bit address space. <>


Previous Next Contents Index