|
HP COBOL Reference Manual
5.3.18 Data-Name
Function
data-name specifies a data item that your program can
explicitly reference. FILLER specifies an item that cannot be
explicitly referenced.
data-name
Syntax Rules
- In the File, Working-Storage, and Linkage Sections,
data-name or the key word FILLER (if present) must be the
first word after the level-number in each data description entry.
- In the Report Section, data-name need not appear in a
report group description entry and the key word FILLER must not be used.
General Rules
- If there is no data-name or FILLER clause, the compiler
treats the data item as a FILLER item.
- The key word FILLER can name a data item. However, a program cannot
explicitly refer to FILLER items.
- The key word FILLER can name a conditional variable. A program
cannot refer to the conditional variable. However, it can refer to the
value of the conditional variable by referring to its associated
condition-names.
- In the Report Section, data-name must be used when:
- data-name represents a report group to be referred to by a
GENERATE or a USE statement in the Procedure Division.
- Reference will be made to the sum counter in the Procedure Division
or Report Section.
- The UPON phrase of the SUM clause references a DETAIL report group.
- data-name provides sum counter qualification.
- If this clause is omitted, the Report Writer Control System does
not allow explicit references to the data item.
Examples
- Elementary FILLER items:
In this example, the program can refer
only to the group item, ITEMA.
01 ITEMA.
03 FILLER PIC X(10) VALUE SPACES.
03 PIC X(2) VALUE "AB".
03 PIC 9 VALUE 6.
|
- Group FILLER items:
In this example, the program can refer to
any elementary item. However, it cannot refer to the record or to the
group item that contains ITEMC and ITEMD.
01 FILLER.
03 ITEMA PIC X(4).
03 ITEMB PIC 9(7).
03 FILLER.
05 ITEMC PIC X.
05 ITEMD PIC 9(8)V99.
03 ITEME PIC X.
|
- Report Writer items:
In this Report Writer example, the program
can refer to DL-NAME and DETAIL-LINE, but not to the data beginning in
LINE 10, COLUMN 25. Note that FILLER cannot be used in place of a
Report Writer data-name.
01 DETAIL-LINE TYPE IS DETAIL.
02 LINE 10.
03 DL-NAME COLUMN 1 SOURCE INPUT-NAME.
03 COLUMN 25 SOURCE INPUT-ADDRESS.
|
5.3.19 DATA RECORDS
Function
The DATA RECORDS clause documents the names of a file's record
description entries.
rec-name
is the name of a data record. It must be defined by a level 01 data
description entry subordinate to the file description entry.
Syntax Rule
The order of appearance of multiple rec-name entries is not
significant.
General Rule
The DATA RECORDS clause is for documentation only.
5.3.20 ERASE (Alpha, I64)
Function
The ERASE clause clears from the starting cursor position to the end of
either the line or the screen.
Syntax Rule
The ERASE clause can be specified only for elementary screen
description entries.
General Rules
- Blanking begins at the starting position of the screen item in
whose description the ERASE EOL clause is included, and continues to
the end of the line.
- Blanking begins at the starting position of the screen item in
whose description the ERASE EOS clause is included, and continues
through to the end of the screen.
- If you specify neither the BLANK nor the ERASE clause, only the
particular character positions corresponding to the screen item are
modified when the element is displayed. The rest of the screen content
remains the same.
- The ERASE clause is ignored in an ACCEPT statement.
Additional References
Section 6.8.10 statement in Chapter 6
5.3.21 EXTERNAL
Function
The EXTERNAL clause specifies that a data item or a file connector in a
defining program is common to other programs in the run unit if the
program defines it identically. The group and elementary data items of
an external data record and files associated with an external file
connector are available to every program in the image that describes
them.
Syntax Rules
- The EXTERNAL clause can appear only in file description entries or
in record description entries in the Working-Storage Section.
- In a record description entry, only level numbers 01 and 77 can
specify the EXTERNAL clause.
- A program and any program it contains, cannot define identical
data-names if their data description entries or file
description entries have EXTERNAL clauses.
- The VALUE clause or the REDEFINES clause cannot be in a data
description entry that contains or is subordinate to, an entry that
contains the EXTERNAL clause.
- When using the SAME RECORD AREA clause for several files, the
Record Description entries or the file description entries for these
files must not include the EXTERNAL clause.
- Entries that contain the EXTERNAL clause must be named.
General Rules
- Data in a record either subordinate to an external FD, or named by
the subject of the EXTERNAL clause, is external. Any program in the
image that describes and optionally redefines this data may access and
process this data subject to the following general rules.
- If two or more programs in the image describe the same external
data record, the associated data description entries (except the GLOBAL
clause) must be identical. All subordinate data-names, data
items, and redefinitions must also be identical.
- A program that describes an external data record can contain a Data
Description entry that redefines the complete external record. This
redefinition need not be the same in other programs in the image.
- Use of the EXTERNAL clause does not imply that the associated
file-name or data-name is a global name.
- The file connector associated with a file description entry is an
external file connector.
- If two or more programs in an image describe the same external file
connector, the clauses associated with the description of that file
must be functionally identical and any data items referenced by those
clauses must be external.
Technical Notes
- Each external sequential file becomes a print format file.
- Each external data record becomes a PSECT (on OpenVMS systems) or a
global (on Tru64 UNIX systems), whose name is the 01-level record.
Each file connector for external files becomes a PSECT (on OpenVMS
systems) or a global (on Tru64 UNIX systems), whose name is the name
of the file. The records associated with this file become external data
records. External record items and files are implemented as
overlayable shared PSECTs (on OpenVMS systems) or globals (on
Tru64 UNIX systems). Therefore, the same storage area is shared
among all separately compiled programs for that named external record
or file. The PSECT or global is created for compatibility with BASIC
COMMON/MAP and FORTRAN labeled COMMON. On OpenVMS, for more
information on overlayable PSECTs, refer to the LINK documentation in
the OpenVMS documentation set. <> On Tru64 UNIX, for more
information on globals, refer to the
ld
documentation in the Tru64 UNIX documentation set. <>
- On Tru64 UNIX systems, an external data item is case-sensitive.
By default, an external data item is converted to lowercase for all
separately compiled program units. Other programs (HP COBOL as
well as other languages) must specify the data item in lowercase.
However, if the
names
option is set to
uppercase
on the command line, other programs must specify the data item in
uppercase. If the
names
option is set to
as_is
, the effect on an external data item is as if
uppercase
were specified. (The
as_is
setting is used for calling non-COBOL programs with mixed case.)
<>
Additional References
Examples
In the following Working-Storage entries, the data items in RECORD-A
are available to any program in the run unit that also describes
RECORD-A and its data items. RECORD-B and the data items in it are not
available to any other program.
01 RECORD-A EXTERNAL.
03 ITEMA PIC X.
03 ITEMB PIC X(22).
03 ITEMC PIC 999.
01 RECORD-B.
03 ITEMA PIC X(12).
03 ITEMD PIC X.
03 ITEME PIC 9(18).
|
|