• Keine Ergebnisse gefunden

Data Description

Im Dokument U I • System 80 (Seite 108-149)

77-level-des:ri~tion-entrYj-

5.3.3. Data Description

Function

A data description entry specifies the characteristics of a specific data item.

5-22

Format 1

level-number {data-nameD'}

FILLER

[;REDEFINES data-name-2]

[;{::~TURE} IS character-string]

;[USAGE IS] COMPUTATIONAL COMP

r---l

COMPUT A TI ONAL - 1

!COMP-1

I

COMPUTATIONAL-2

!COMP-2 I

COMPUTATIONAL-3

ICOMP-3 I

COMPUTATIONAL-4

l C~M~

-: ____

J

DISPLAY INDEX

[

;[SIGN IS] {LEADING} [SEPARATE CHARACTER]]

TRAILING

;OCCURS {~nteger-1} TO integer-2 TIMES DEPENDING ON mteger -2 TIMES

[ {

ASCENDING} KEY IS data-name-4 [,data-name-5]

DESCENDING

[INDEXED BY index-nameD' [,index-name-2] ... ]

[

;{SYNCHRONIZED}[{LEFT }]]

SYNC RIGHT

[; {~IFIED} RIGHT]

[;BLANK WHEN ZERO]

[;VALUE IS literal].

data-name-3

-- -]-

-

-7004 4490-000

Data Division

Format 2

66 data-name-1;RENAMES data-name-2 [

{~~:~UGH}

data-name-3]_

Format 3

88 condition-name; {VALUE IS } literal-1 [{THROUGH} literal-2]

VALUES ARE THRU

[, LiteraL -3

[{~~:~UGH}

LiteraL -4]] __ _

Rules

1. There are three formats for data description entries:

4) Format 1 is used for record description entries in the file, working-storage, and Linkage Sections and for data item description entries in the working-storage and Linkage Sections.

• Format 2 is used to assign alternative names to existing data items or groups of items. (See "RENAMES Clause" in this subsection.)

• Format 3 is used to assign a name to the values that an associated conditional variable may possess during object program execution. (See format 2 under "VALUE Clause" in this subsection.)

2. In Levell, the level-number in format 1 may be any number from 01 through 10 or 77. In Level 2, the level-number in format 1 may be any number from 01 through 49 or 77.

3. The clauses may be written in any order with two exceptions:

• The data-name-1 or FILLER clause must immediately follow the level-number .

., The REDEFINES clause, when used, must immediately follow the data-name-1 clause.

4. The PICTURE clause must be specified for every elementary item except an index data item, for which use of this clause is prohibited.

5. The words THRU and THROUGH are equivalent.

7004 4490-000 5-23

Data Division

5-24

6. The clauses SYNCHRONIZED, PICTURE, JUSTIFIED, and BLANK WHEN ZERO must not be specified except for an elementary data item.

7. Format 3 is used for each condition-name. Each condition-name requires a separate entry with level-number 88. Format 3 contains the name of the condition and the value, values, or range of values associated with the condition-name. The condition-name entries for a particular conditional variable must follow the entry describing the item with which the condition-name is associated.

A condition-name can be associated with any data description entry that contains a level-number except the following:

• Another condition-name

• A level-66 item

• A group containing items with descriptions including JUSTIFIED, SYNCHRONIZED, or USAGE other than USAGE IS DISPLAY

e An index data item (See format 2 under "USAGE Clause" later in this subsection.)

Table 5-5 summarizes the functions of the clauses used in data description entries.

The formats and functions of these clauses are described in detail in the paragraphs that follow.

7004 4490-000

Data Division

Table 5-5. Data Description Entry Clauses

Clause Function

data-name or FILLER Specifies the name of the data being described

REDEF I NES Allows the programmer to give an alternate description of an area of computer storage

PICTURE Indicates the size, class (alphabetic, numeric, or alphanumeric), and the editing requirements for an elementary data item

USAGE Specifies the manner in which the data is stored in main storage SIGN Specifies the position and mode of representation of the

operational sign for numeric data

OCCURS Indicates the number of elements contained in a table

SYNCHRONIZED Specifies the alignment of an elementary item on a natural boundary of the computer memory

JUSTI F I ED Specifies that nonnumeric data is to be right-justified in a nonnumeric field

BLANK WHEN ZERO Specifies that an item is to be set to blanks whenever its value is zero

VALUE Defines the initial value of a working-storage item or a value or range of values associated with a condition-name

RENAMES Permits alternate, possibly overlapping, groupings of elementary items

70044490-000 5-25

Data Division

Level-Number Function

The level-number shows the hierarchy of data within a logical record.

In addition, it is used to identify entries for working-storage items, linkage items,lcondition-names, and the RENAMES clause.

I

Format level-number Rules

1. A level-number is required as the first element in each data description entry.

2. Data description entries subordinate to an FD, SD, or CD entry must have level-numbers with the values 01 through 10 in Levell; 01 through 49,66, or 88 in Level 2.

3. Data description entries in the Working-Storage Section and Linkage Section must have level-numbers with the values 01 through 10 or 77 in Level 1;101 through 49,66,77, or 88 in Level

2.1

4. The level-number 01 identifies the first entry in each record description.

5. Special level-numbers are assigned to certain entries where there is no real concept of level:

4& Level-number 77 is assigned to identify noncontiguous data

items and can be used only as described by format 1.

4& Level-number 66 is assigned to identify RENAMES entries and

can be used only as described in format 2.

• Level-number 88 is assigned to entries that define

condition-names associated with a conditional variable and can be used only as described in format 3.

6. Multiple level 01 entries subordinate to any given level-indicator represent implicit redefinitions of the same area.

5-26 7004 4490-000

Division

Data-NamejFlllER Clause Function

A data-name specifies the name of the data being described. The keyword

FILLER specifies an elementary item of the logical record that cannot be referred to explicitly.

Format {

data-name}

FILLER Rules

1. In the File, Working-Storage, and Linkage Sections, a data-name or the keyword FILLER must be the first word following the level-number in each data description entry.

2. The keyword FILLER may be used to name an elementary item in a record.

Under no circumstances can a FILLER item be referred to explicitly.

However, the keyword FILLER may be used as a conditional variable

because such use does not require explicit reference to the FILLER item, but to its value.

REDEFINES Clause Function

The REDEFINES clause allows the same computer storage area to be described by different data description entries.

Format

level-number data-name-1;REDEFINES data-name-2

Note: Level-number, data-name-l,

I

and the semicolon

I

are shown in the format to improve clarity. Level-number and data-name-l are not part of the REDEFINES clause.

Rules

1. The REDEFINES clause, when specified, must immediately follow data-name-1.

2. The level-numbers of data-name-! and data-name-2 must be identical, but must not be 66 or 88.

70044490-000 5-27

Data Division

5-28

3. This clause must not be used in level 01 entries in the File Section or the Communication Section.

4. No entry having a level-number numerically lower than the level-number of data-name-2 and data-name-l may occur between the data description entries of data-name-2 and data-name-l.

5. Redefinition starts at data-name-2 and ends when a level-number less than or equal to that of data-name-2 is encountered.

6. When the level-number of data-name-l is other than 01, it must specify the same number of character positions that the data item referenced by

data-name-2 contains. The REDEFINES clause specifies the redefinition of a storage area, not of the data items occupying the area.

7. The data description entry for data-name-2 cannot contain a REDEFINES clause. In Levell, data-name-2 cannot be subordinate to an entry that contains a REDEFINES clause. In Level 2, data-name-2 rna be subordinate to an entry that contains a REDEFINES clause. The data description entry for data-name-2 cannot contain an OCCURS clause.IHowever, data-name-2 may be subordinate to an item whose data description entry contains an OCCURS clause. In this case, the reference to data-name-2 in the

~~~~~--~~~

REDEFINES clause may not be subscripted or indexed.IN either the original definition nor the redefinition can include an item whose size is variable as defined in the OCCURS clause.

8. Multiple redefinitions of the same character positions are permitted. The entries giving new descriptions of character positions must follow the entries defining the area being redefined without intervening entries defining new character positions. Multiple redefinitions of the same character positions must all use the data-name of the entry that originally defined the area.

Example 02 A.

04 A1 PICTURE X(3).

04 A2 PICTURE 99V99.

02 B REDEFINES A.

04 B1 PICTURE 9.

04 B2 PICTURE A(4).

04 B3 PICTURE XX.

02 C REDEFINES A PICTURE 9(4)V9(3).

9. The entries giving the new description of the character positions must not contain any VALUE clauses [except in condition-name entries.

I

10. Multiple level 01 entries subordinate to any given level-indicator represent implicit redefinitions of the same area.

7004 4490-000

Data Division

PICTURE Clause Function

The PICTURE clause describes the general characteristics and editing

requirements of an elementary item. See Appendix K for a tutorial description of the PICTURE clause and for additional examples.

Format

{

PICTURE} IS character-string PIC

Rules

7004 4490-000

1. A PICTURE clause can be specified only at elementary item level.

2. The maximum number of characters allowed in the character-string is 30.

3. PIC is an abbreviation for PICTURE.

4. The PICTURE clause must be specified for every elementary item except an index data item@i!~.fallE1terna!!loatini-~~f}~iEfor which use of this clause is prohibited.

5. A character-string consists of certain allowable combinations of characters in the COBOL character set used as symbols. The allowable combinations determine the category of the elementary item.

6. There are five categories of data that can be described with a PICTURE clause: alphabetic, numeric, alphanumeric, alphanumeric edited, and numeric edited.

The five categories of data items are grouped into three classes: alphabetic, numeric, and alphanumeric. For alphabetic and numeric, the class and the category are synonymous. The alphanumeric class includes the categories of alphanumeric (without editing), alphanumeric edited, and numeric edited.

Every elementary item except for an index data item belongs to one of the classes and to one of the categories. The class of a group item is treated at object time as alphanumeric regardless of the class of elementary items subordinate to that group item.

The relationship of the class and category for elementary and group data items is shown in Table 5-6.

5-29

5-30

Table 5-6. Class and Category of Elementary and Group Data Items

Level of Item Class Category Elementary Alphabetic Alphabetic

Numeric Numeric Alphanumeric Numeric edited

Alphanumeric edited Alphanumeric Group ALphanumeric Alphabetic

Numeric Numeric edited Alphanumeric edited Alphanumeric

7. The maximum size of an elementary item is defined as follows:

Alphabetic Numeric

Numeric edited Alphanumeric edited Alphanumeric

8. To define an item as alphabetic:

4,092 bytes

Size in bytes is determined by the USAGE and SIGN clauses, which are described in this subsection.

120 bytes 120 bytes 4,092 bytes

a. Its PICTURE character-string can only contain the symbols A and B.

b. Its content when represented in standard data format must be any combination of the 26 letters in the alphabet and the space character.

9. To define an item as numeric:

• Fixed-Point Items

_Tj:l~r~ ~~ t.h~~ types of fixed-point items: external decimal, binary, and li~t~~~~e~IE:~jCSee "USAGE Clause" in this subsection.)

The PICTURE character-string of a fixed-point item can only contain the symbols 9, P, S, and V. The number of digit positions that can be described by the PICTURE character-string must range from 1 to 18, inclusive.

7004 4490-000

70044490-000

If unsigned, the contents of a data item represented in standard data format must be a combination of the numerals 0 through 9; if signed, the item may also contain a +, -, or other representation of an

operational sign. (See "SIGN Clause" in this subsection.)

~---~

Floating-Point Items

I

I

The floating-point items define data having a potential range of value

I I

too great for fixed-point presentation. The magnitude of the number

I I

represented by a floating-point item must be greater than 5.4 x 10-79

I

I

but must not exceed 0.72 x 1076,

I

I

There are two types of floating-point items: internal floating-point and

I

I

external floating-point.

I

i

No PICTURE clause may be associated with an internal floating-point

I

I

I

item. The USAGE clause for an internal floating-point item is

I

COMPUTATIONAL-lor COMPUTATIONAL-2. (See "USAGE Clause"

I

I

in this subsection.)

I

I

An external floating-point item has the USAGE of DISPLAY and a

I

I PICTURE character-string in the following format:

I

I I

A plus indicates that the data is positive if preceded by a plus, or negative if preceded by a minus.

A minus indicates that the data is positive if preceded by a space character, or negative if preceded by a minus.

The plus sign, the space character, or the minus sign occupies one byte of main storage.

mantissa

Is represented by the symbols: 9, period C), or V. Each 9 represents a digit position and occupies one byte of main storage. From one to sixteen 9s may be present in the mantissa string.

The period represents an actual decimal point and occupies one byte of storage. The V represents an assumed decimal point, which does not occupy any main storage.

I

One actual or assumed decimal point must be present in the

L

mantissa as a leading, embedded, or trailing symbol.

.J

-5-31

Data Division

5-32

, - - - l

: E Indicates the exponent. It occupies one byte of main storage. :

I

exponent

I

I

Specifies a power of10 that is used as a multiplier. It is

I I

represented by two consecutive 9's. Each 9 occupies one byte of

I

I

main storage.

I

I

I

No VALUE clause may be associated with an external floating-point II I item.

L _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ~

10. To define an item as alphanumeric:

., Its PICTURE character-string is restricted to certain combinations of the symbols A, X, and 9, and the item is treated as if the

character-string contained all X's. A PICTURE character-string that contains all Ns or all 9's does not define an alphanumeric item.

.. Its content, when represented in standard data format, is allowable characters in the computer character set.

11. To define an item as alphanumeric edited:

.. Its PICTURE character-string is restricted to certain combinations of the following symbols:

AX9 B 01

As a minimum, it must contain either of the following:

At least one B, 0, or 1 and one X At least one 0 or 1 and one A

• Its content, when represented i~ standard data format, is allowable characters in the computer character set.

12. To define an item as numeric edited:

• Its PICTURE character-string is restricted to certain combinations of the following symbols:

B 1 P V Z 0 9 , .

*

+ -CR DB or currency symbol

The allowable combinations are determined from the order of precedence of symbols and the editing rules.

The number of digit positions that can be represented in the PICTURE character-string must range from 1 to 18 inclusive.

70044490-000

7004 4490-000

Data Division

The character-string must contain at least one of the following symbols:

OBI Z

*

+ , . -CR DB or currency symbol

• The content of the character positions of these symbols that are allowed to represent a digit in standard data format must be one of the

numerals.

13. An integer that is enclosed in parentheses following the symbols:

A , X 9 P Z

*

B I 0 + -or currency symbol

indicates the number of consecutive occurrences of the symbol. The following symbols may appear only once in a given PICTURE:

SV. CRDB E

14. The functions of the symbols used in a PICTURE character-string other than floating point to describe an elementary item are explained as follows:

Symbol A

B

P

Description

Represents a character position that contains only a letter of the alphabet or a space

Represents a character position into which the space character is to be inserted

Indicates an assumed decimal scaling position and specifies the location of an assumed decimal point when the point is not within the number thatappears in the data item. The P is not counted in the size of the data item, but is counted in

determining the maximum number of digit positions (18) in numeric-edited items or numeric items. The P can appear only to the left or right as a continuous string ofP's within a

PICTURE description.

Since the P implies an assumed decimal point (to the left of the P's if P's are leftmost PICTURE characters, and to the right if the P's are rightmost PICTURE characters), the assumed decimal point symbol V is redundant as either the leftmost or rightmost character within such a PICTURE description.

The character P and the period insertion character ( . ) cannot both occur in the same PICTURE character-string.

5-33

Data Division

If, in any operation involving conversion of data from one form of internal representation to another, the data item being converted is described with the PICTURE character P, each digit position described by a P is considered to contain the value zero, and the size of the data item is considered to include the digit positions so described.

Indicates the presence of an operational sign but not its representation nor, necessarily, its position. It must be written as the leftmost character in the PICTURE and is not counted in determining the size (in terms of standard data format characters) of the elementary item unless the entry is subject to a SIGN clause that specifies the optional SEPARATE CHARACTER phrase. (See "SIGN Clause" in this subsection.) Indicates the location of the assumed decimal point and may only appear once in a character-string. The V does not

represent a character position and, therefore, is not counted in the size of the elementary item. When the assumed decimal point is to the right of the rightmost symbol in the string, the V is redundant.

Represents a character position that contains any allowable character from the computer character set.

Represents a leading numeric character position. When that position contains a 0, the 0 is replaced by a space character.

Each Z is counted in the size of the item.

Represents a character position that contains a numeral and is counted in the size of the item.

Represents a character position into which the numeral 0 is to be inserted. The 0 is counted in the size of the iten1.

Represents a character position into which the stroke character is to be inserted. The / is counted in the size of the item.

Represents a character position into which a comma is to be inserted. This character position is counted in the size of the item. The comma insertion character must not be the last character in the PICTURE character-string.

70044490-000

Data Division

Symbol Description

. (period) Is an editing symbol that represents the decimal point for alignment purposes and, in addition, represents a character position into which a decimal point is to be inserted. A period is counted in the size of the item. The functions of the period and comma are exchanged if the clause DECIMAL-POINT IS COMMA is stated in the SPECIAL-NAMES paragraph. In this exchange, the rules for the period apply to the comma and the rules for the comma apply to the period wherever they appear in a PICTURE clause. The insertion character period must not be the last character in the PICTURE character-string.

+ -CRDB Are used as editing sign control symbols. They represent the character position into which the editing sign control symbol is placed. These symbols are mutually exclusive in anyone character-string and each character used in the symbol is counted in determining the size of the data item.

*

cs

Represents a leading numeric character position into which an asterisk is placed when that position contains a zero. Each asterisk is counted in the size of the item.

Represents a character position into which a currency symbol is to be placed. The currency symbol in a character-string is represented by either the currency sign ($) or by the single character specified in the CURRENCY SIGN clause in the SPECIAL-NAMES paragraph. The currency symbol is counted in the size of the item.

15. There are two general methods of performing editing in the PICTURE clause: insertion or suppression and replacement.

The four types of insertion editing are:

The four types of insertion editing are:

Im Dokument U I • System 80 (Seite 108-149)