Data Description Entry COBOL

A data description entry specifies data item characteristics.

Format 1:Data-Name Full Declaration

Data-Name Full Declarationk

Data-Name Full Declaration

Format 2:Data-Name Renames

Data-Name Renames

Format 3:Condition-Name Declaration

Condition-Name Declaration

Format 4:Constant-Name Declaration

Constant-Name Declaration

The clauses may be written in any order except that data-name-1 or the FILLER clause, if specified, must immediately follow level-number.

The PICTURE clause must not be specified for the subject of a RENAMES clause or for an item whose usage is index or pointer. For any other entry describing an elementary item, a PICTURE clause must be specified except that the PICTURE clause may be omitted for an elementary item when a nonnumeric literal is specified in the VALUE clause.In the latter case, a PICTURE clause is implied of the form ‘PICTURE X(length)’, where length is the length of the literal specified in the VALUE clause.

The compiler supports an implied PICTURE character-string when the VALUE clause specifies a numeric literal.This enhancement is in addition to the feature of an implied PICTURE character-string when the VALUE clause specifies a nonnumeric literal.

When the VALUE clause specifies a numeric literal and the PICTURE clause is not specified, the implied PICTURE character-string is derived from the numeric literal specified in the VALUE clause, according to the following rules:

  1. The implied PICTURE character-string has an S if and only if the numeric literal has a sign.
  2. The implied PICTURE character-string has as many of the symbols 9 as there are digits specified in the numeric literal.The numeric literal may specify leading or trailing zero digits, which will be counted in determining the number of symbols 9 in the implied PICTURE character-string.

The words THRU and THROUGH are equivalent.

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

The EXTERNAL clause may be specified only in data description entries in the Working-Storage Section whose level-number is 01.

The EXTERNAL clause and the REDEFINES clause must not be specified in the same data description entry.

The GLOBAL clause may be specified only in data description entries whose level-number is 01.

data-name-1 must be specified for any entry containing the GLOBAL or EXTERNAL clause, or for record descriptions associated with a file description entry that contains the EXTERNAL or GLOBAL clause.

Format 3 is used to define 88-level condition-names.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 88-level condition-name
  • A level 66 item (RENAMES)
  • A level 78 item (constant-name)
  • A group containing items with descriptions including JUSTIFIED, SYNCHRONIZED or USAGE (other than USAGE IS DISPLAY)
  • An index data item

Format 4 is used to define constant-names.Each constant-name requires a separate entry with level-number 78.Format 4 contains the name of the constant and the value associated with the constant-name.The constant-name may be used wherever a literal is specified in a format, unless otherwise forbidden. The effect of specifying a constant-name is as if the literal value associated with the constant-name had been specified instead of the constant-name.A constant-name with an integer value may also be used wherever an integer value is specified in a format or as the repeat count in a PICTURE character-string.A constant-name with an integer value may also be used as a level-number or segment-number.

A constant-name may only be used after it has been declared in a data description entry. That is, a constant-name must not be the object of a forward reference. A constant-name may not be used for a literal text-name or literal library-name in a COPY statement, or a literal program-name in a PROGRAM-ID paragraph or END PROGRAM header.

Constant-names are implicitly global.

Each data description entry must end with a period separator.

BLANK WHEN ZERO Clause

BLANK WHEN ZERO

The BLANK WHEN ZERO clause permits the blanking of an item when its value is zero.

The BLANK WHEN ZERO clause can be used only for an elementary item whose PICTURE is specified as numeric or numeric edited and whose usage is explicitly or implicitly DISPLAY.

The BLANK WHEN ZERO clause must not be specified in the same entry with a PICTURE clause having an asterisk as the zero suppression symbol.

The BLANK WHEN ZERO clause must not be specified in the same entry with a PICTURE clause that specifies an operational sign with the symbol S.However, if the separate sign option is specified in the Compile Command, then the BLANK WHEN ZERO clause may be specified in the same entry with a PICTURE clause that specifies an operational sign; in this case, the operational sign symbol S is ignored and a trailing symbol + assumed in the PICTURE character-string.

When the BLANK WHEN ZERO clause is used, the item will contain nothing but spaces if the value of the item is zero.

When the BLANK WHEN ZERO clause is used for an item whose PICTURE is numeric, the category of the item is considered to be numeric edited.

Data-Name or FILLER Clause

Data-Name or FILLER Clause

A data-name specifies the name of the data being described.The keyword FILLER specifies an item of the logical record that cannot be referred to explicitly.

If either data-name-1 or the keyword FILLER is specified, it must be the first word following the level-number in each data description entry.If this clause is omitted, the data item being described is treated as though FILLER had been specified.

The keyword FILLER may be used to name a data item.Under no circumstances can a FILLER item be referred to explicitly. However, the keyword FILLER may be used to name a conditional variable:such use does not require explicit reference to the FILLER item, but to its value.

EXTERNAL Clause

IS EXTERNAL

The EXTERNAL clause specifies that a data item is external.The constituent data items and group data items of an external data record are available to every program in the run unit which describes that record.

The EXTERNAL clause may be specified in record description entries in the Working-Storage Section.

In the same program, the data-name specified as the subject of the entry whose level-number is 01 that includes the EXTERNAL clause must not be the same data-name specified for any other data description entry which includes the EXTERNAL clause.

The VALUE clause must not be used in any data description entry that includes, or is subordinate to, an entry which includes the EXTERNAL clause.The VALUE clause may be specified for condition-name entries associated with such data description entries.

The data contained in the record named by the data-name clause is external and may be accessed and processed by any program in the run unit which describes and, optionally, redefines it subject to the rules set forth in the paragraphs that follow.

Within a run unit, if two or more programs describe the same external data record, each record-name of the associated record description entries must be the same and the records must define the same number of standard data format characters.However, a program that describes an external record may contain a data description entry including the REDEFINES clause that redefines the complete external record, and this complete redefinition need not occur identically in other programs in the run unit.

Use of the EXTERNAL clause does not imply that the associated data-name is a global name.

GLOBAL Clause

IS GLOBAL

The GLOBAL clause specifies that a data-name is a global name.A global name is available to every program contained within the program that declares it.

The GLOBAL clause may be specified in record description entries in the File Section or the Working-Storage Section.

In the same Data Division, the data description entries for any two data items for which the same data-name is specified must not include the GLOBAL clause.

A data-name described using a GLOBAL clause is a global name. All data-names subordinate to a global name are global names. All condition-names associated with a global name are global names.

A statement in a program contained directly or indirectly within a program which describes a global name may reference that name without describing it again.

If the GLOBAL clause is used in a data description entry that contains the REDEFINES clause, it is only the subject of that REDEFINES clause which possesses the global attribute.

JUSTIFIED Clause

JUSTIFIED Clause

The JUSTIFIED clause specifies nonstandard positioning of data within a receiving data item.

When a receiving data item is described with the JUSTIFIED clause and the sending data item is larger than the receiving data item, the leftmost characters are truncated.When a receiving data item is described with the JUSTIFIED clause and it is larger than the sending data item, the data is aligned at the rightmost character position in the data item with space-fill for the leftmost character positions.

When the JUSTIFIED clause is omitted, the standard rules for aligning data within an elementary item apply.

The JUSTIFIED clause cannot be specified for an index data item or for any data item described as numeric or for which editing is specified.

The JUSTIFIED clause can be specified only at the elementary item level.

JUST is an abbreviation for JUSTIFIED.

Level-Number

level-number-1

The level-number shows the hierarchy of data within a logical record.In addition, it identifies entries for working storage items, linkage items, condition-names, constant-names, and the RENAMES clause.

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

Data description entries subordinate to a CD, FD or SD entry must have level-numbers with values 01 through 49, 66, 78, or 88.

Data description entries in the Working-Storage Section and Linkage Section must have level-numbers with the values 01 through 49, 66, 77, 78, or 88.

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

Level-number 66 is assigned to identify RENAMES entries.

Level-number 77 is assigned to identify noncontiguous working storage data items and noncontiguous linkage data items.

Level-number 78 is assigned to identify constant-names.

Level-number 88 is assigned to identify condition-names associated with a conditional variable.

Multiple level 01 entries subordinate to any given level indicator CD, FD or SD, represent implicit redefinitions of the same area.

OCCURS Clause

Format 1:Fixed Number of Occurrences

Fixed Number of Occurrences

Format 2:Variable Number of Occurrences

Variable Number of Occurrences

The OCCURS clause eliminates the need for separate entries for repeated data items and supplies information required for the application of subscripts.

The OCCURS clause is used in defining tables and other homogeneous sets of repeated data items.Whenever the OCCURS clause is used, the data-name which is the subject of this entry must be subscripted whenever it is referred to in a statement other than SEARCH.Further, if the subject of this entry is a group item, all data-names belonging to the group must be subscripted whenever they are used as operands, except as the object of a REDEFINES clause.

The OCCURS clause cannot be specified in a data description entry that:

  • Has an 01, 66, 77, 78, or 88 level-number.However, in the Working-Storage Section, the OCCURS clause may be specified in a data description entry with an 01 or 77 level-number.
  • Has a variable-occurrence data item subordinate to it.

Except for the OCCURS clause itself, all data description clauses associated with an item whose description includes an OCCURS clause apply to each occurrence of the item described.

The number of occurrences of the subject entry is defined as follows:

  • In Format 1, the value of integer-2 represents the exact number of occurrences.
  • In Format 2, the current value of the data item referenced by data-name-3 represents the number of occurrences.

This format specifies that the subject of this entry has a variable number of occurrences.The value ofinteger-2 represents the maximum number of occurrences and the value of integer-1 represents the minimum number of occurrences. This does not imply that the length of the subject of the entry is variable, but that the number of occurrences is variable.

At the time of reference to the subject of this entry or to any containing or subordinate data item, the value of the data item referenced by data-name-3 must fall within the range integer-1 through integer-2 .The contents of the data items whose occurrence numbers exceed the value of the data item referenced by data-name-3 are undefined.

When both integer-1 and integer-2 are used, the value of integer-1 must be less than the value of integer-2 .The value of integer-1 may be zero. If integer-1 is omitted, it is assumed to be zero.

The data description of data-name-3 must describe an integer. data-name-3 may be qualified.If data-name-3 is specified, is not qualified, and is not defined in the Data Division, the compiler assumes a Working-Storage Section data description entry of the following form:

01 data-name-3 PIC 9(9) BINARY(4).

A data description entry that contains Format 2 of the OCCURS clause may be followed, within that record description, only by data description entries that are subordinate to it.

When a group data item having subordinate to it an entry that specifies Format 2 of the OCCURS clause is referenced, the part of the table area used in the operation is determined as follows:

  1. If the data item referenced by data-name-3 is outside the group, only that part of the table area that is specified by the value of the data item referenced by data-name-3 at the start of the operation is used.
  2. If the data item referenced by data-name-3 is included in the same group and the group data item is referenced as a sending item, only that part of the table area that is specified by the value of the data item referenced by data-name-3 at the start of the operation is used in the operation.If the group is a receiving item, the maximum length of the group is used.

If Format 2 is specified in a record description entry and the associated file description or sort-merge description entry contains the VARYING phrase of the RECORD clause, the records are variable length.If the DEPENDING ON phrase of the RECORD clause is not specified, the content of the data item referenced by data-name-3 of the OCCURS clause must be set to the number of occurrences to be written before the execution of any RELEASE, REWRITE or WRITE statement.

In the KEY IS phrase, the first specification of data-name-4 must be the name of either the entry containing the OCCURS clause or an entry subordinate to it.Subsequent specifications of data-name-4 must be subordinate to the entry containing the OCCURS clause.Each data-name-4 may be qualified, but must not be subscripted, as is normally required. For eachdata-name-4, the associated data description must not include an OCCURS clause, except when the first data-name-4 is the same as the entry containing the OCCURS clause.There may not be any OCCURS clauses between this OCCURS clause and the descriptions of any data-name-4.

When the KEY IS phrase is specified, the repeated data must be arranged in ascending or descending order according to the values contained in data-name-4. The ascending or descending order is determined according to the rules for comparison of operands.The data-names are listed in their descending order of significance.

An INDEXED BY phrase may be used to define one or more index-names to be associated with the subject of this entry. Index-names are not data-names, and they may be used only in contexts where the formats explicitly mention them.An index-name is a user-defined word, and each index-name must be unique within the program. Index-names are used principally in subscripts, and their use in this context can result in more efficient access to the elements of a table.

PICTURE Clause

PICTURE Clause

The PICTURE clause describes the general characteristics and editing requirements of an elementary item.

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

character-string-1 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.The maximum number of characters allowed in the character-string is 30.

The lowercase letters corresponding to the uppercase letters representing the PICTURE symbols A, B, P, S, V, X, Z, CR, DB are equivalent to their uppercase representations in a PICTURE character-string.Other lowercase letters are not equivalent to their corresponding uppercase representations.This means that if a lowercase q, for example, has been designated as the currency symbol the uppercase Q may not be substituted for it, and vice versa.

The PICTURE clause must not be specified for the subject of a RENAMES clause or for an item whose usage is index or pointer. For any other entry describing an elementary item, a PICTURE clause must be specified except that the PICTURE clause may be omitted for an elementary item when an alphanumeric literal is specified in the VALUE clause.In the latter case, a PICTURE clause is implied of the form 'PICTURE X(length)', where length is the length of the literal specified in the VALUE clause.

PIC and PICTURE are synonymous.

The asterisk when used as the zero suppression symbol and the BLANK WHEN ZERO clause may not appear in the same entry.

Character-String (Data Categories)

The five categories of data that can be described with a PICTURE clause are defined as follows:

  1. Alphabetic:Its PICTURE character-string can contain only the symbol A .The contents of an alphabetic data item when represented in standard data format must be one or more alphabetic characters (“a” through “z”, “A” through “Z”, and space).
  2. Numeric:Its PICTURE character-string can contain only the symbols 9, P, S, and V. Its PICTURE character-string must contain at least one symbol 9 and not more than thirty symbols 9.Each symbol 9 specifies a digit position.If unsigned, the contents of a numeric data item when represented in standard data format must be one or more numeric characters.If signed, a numeric data item may also contain a “+”, “–“, or other representation of an operational sign.The actual in-memory contents of a numeric data item are not standard data format when the usage is other than DISPLAY as specified by a USAGE clause applicable to the data description entry or when the data item is signed and the SEPARATE CHARACTER phrase is not specified in a SIGN clause applicable to the data description entry.
  3. 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 symbols X. The PICTURE character-string must contain at least one symbol X or a combination of the symbols Aand 9. A PICTURE character-string that contains all symbols A or all symbols 9 does not define an alphanumeric data item, since such character-strings define an alphabetic or numeric data item, respectively. The contents of an alphanumeric data item when represented in standard data format must be two or more characters in the character set of the computer.
  4. Alphanumeric edited:Its PICTURE character-string is restricted to certain combinations of the following symbols: A, X, 9, B, 0, and slash (/). The PICTURE character-string must contain at least one symbol A or X and at least one symbol B, 0, or slash (/). The contents of an alphanumeric edited date item when represented in standard data format must be two or more characters in the character set of the computer.
  5. Numeric edited:Its PICTURE character-string is restricted to certain combinations of the following symbols: B, slash (/), P, V, Z, 0, 9, comma (,), period (.), asterisk (*), minus (), plus (+), CR, DB, and the currency symbol (the symbol $ or the symbol specified in the CURRENCY SIGN clause of the SPECIAL-NAMES paragraph). 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 one to thirty, inclusive. The character string must contain at least one symbol 0, B, slash, Z, asterisk, plus, minus, comma, period, CR, DB, or the currency symbol. The contents of each of the character positions in a numeric edited data item must be consistent with the corresponding PICTURE symbol.

Note:The additional data categories, index data and data pointer, also exist, but do not use a PICTURE clause in their data description entry.An index data item is described with the USAGE IS INDEX clause.A data pointer data item is described with the USAGE IS POINTER clause.

The size of an elementary item, where size means the number of character positions occupied by the elementary item in standard data format, is determined by the number of allowable symbols that represent character positions. An unsigned nonzero integer which is enclosed in parentheses following the symbol A, comma (,), X, 9, P, Z, asterisk (*), B, slash (/), 0, plus (+), minus (), or the currency symbol indicates the number of consecutive occurrences of the symbol. Note that the following symbols may appear only once in a given PICTURE: S, V, period (.), CR,and DB

Symbols

The functions of the symbols used in a PICTURE character-string to describe an elementary item are as follows:

The functions of the symbols used in a PICTURE character-string to describe an elementary item are as follows:

A Each symbol A in the character-string represents a character position that can contain only an alphabetic character (“a” through “z”, “A” through “Z”, and space). Each symbol A is counted in the size of the data item described by the PICTURE character-string.

B Each symbol B in the character-string represents a character position into which the character space will be inserted when the data item is the receiving item of an elementary MOVE statement. Each symbol B is counted in the size of the data item described by the PICTURE character-string.

P Each symbol P in the character-string indicates an assumed decimal scaling position and is used to specify the location of an assumed decimal point when the point is not within the number that appears in the data item. The scaling position symbol P is not counted in the size of the data item described by the PICTURE character-string, but each symbol P is counted in determining the maximum number (30) of digit positions in numeric or numeric edited data items. The symbol P may appear only as a continuous string in the leftmost or rightmost digit positions within a PICTURE character-string. Since the scaling position symbol P implies an assumed decimal point (to the left of the symbols P if they are the leftmost digit positions and to the right of the symbols P if they are the rightmost digit positions), the assumed decimal point symbol V is redundant either to the left or right of the symbols P, respectively, within such a PICTURE character-string. The symbol P and the insertion symbol period (.) cannot both occur in the same PICTURE character-string.

In certain operations that reference a data item whose PICTURE character-string contains the symbol P, the algebraic value of the data item is used rather than the actual character representation of the data item. This algebraic value assumes the decimal point in the prescribed location and zero in place of the digit positions specified by the symbol P. The size of the value is the number of digit positions represented by the PICTURE character-string. These operations are any of the following:

  • Any operation requiring a numeric sending operand.
  • A MOVE statement where the sending operand is numeric and its PICTURE character-string contains the symbol P.
  • A MOVE statement where the sending operand is a numeric edited data item and its PICTURE character-string contains the symbol P and the receiving operand is numeric or numeric edited.
  • A comparison operation where both operands are numeric.
  • In all other operations the digit positions specified with the symbol P are ignored and are not counted in the size of the operand.

S The symbol S is used in a character-string to indicate the presence, but neither the representation nor, necessarily, the position of an operational sign. The symbol S must be written as the leftmost character in the PICTURE character-string. The symbol S is not counted in determining the size (in terms of standard data format characters) of the data item described by the PICTURE character-string unless the entry contains or is subject to a SIGN clause that specifies the SEPARATE CHARACTER phrase. The symbol S in the PICTURE character-string and the BLANK WHEN ZERO clause may not occur in the same data description entry.

V The symbol V is used in a character-string to indicate the location of the assumed decimal point and may appear only once in any single PICTURE character-string. The symbol V does not represent a character position and, therefore, is not counted in the size of the data item described by the PICTURE character-string. When the assumed decimal point is to the right of the rightmost symbol in the string representing a digit position or scaling position, or is to the left of scaling positions that represent the leftmost digit positions, the V is redundant. The symbol V and the insertion symbol period (.) cannot both occur in the same PICTURE character-string.

X Each symbol X in the character-string is used to represent a character position that contains any allowable character from the character set of the computer. Each symbol X is counted in the size of the data item described by the PICTURE character-string.

Z Each symbol Z in a character-string may only be used to represent the leftmost leading numeric character positions that will be replaced by space characters when the contents of those character positions are leading zeroes and the data item is the receiving item of an elementary MOVE statement. Each symbol Z is counted in the size of the item described by the PICTURE character-string and in determining the maximum number (30) of digit positions allowed in a numeric edited data item.If the symbol Z is used to the right of the decimal point in a character-string, then all digit positions in that character-string must be described with the symbol Z. If the symbol Z represents all the digit-positions in the character-string, then the described data item is blank when zero, even if the BLANK WHEN ZERO clause is not specified.

9 Each symbol 9 in the character-string represents a character position that contains a numeric character. Each symbol 9 is counted in the size of the item described by the PICTURE character-string and in determining the maximum number (30) of digit positions in a numeric or numeric edited data item.

0 Each symbol 0 in the character-string represents a character position into which the character zero (“0”) will be inserted when the data item is the receiving item of an elementary MOVE statement and removed when a numeric edited data item is the sending item in an elementary MOVE statement with a numeric or numeric edited receiving data item. Each symbol 0 is counted in the size of the data item described by the PICTURE character-string. The symbol 0 does not represent a digit position in a numeric edited data item.

/ Each symbol slash (/) in the character-string represents a character position into which a character slash (“/”) will be inserted when the data item is the receiving item of an elementary MOVE statement. Each symbol slash (/) is counted in the size of the data item described by the PICTURE character-string.

, Each symbol comma (,) in the character-string represents a character position into which a character comma (“,”) will be inserted when the data item is the receiving item of an elementary MOVE statement. Each symbol comma (,) is counted in the size of the data item described by the PICTURE character-string.

. When the symbol period (.) appears in the character-string, it is an editing symbol that represents the decimal point for alignment purposes and, in addition, represents a character position into which the character period (“.”) will be inserted. The symbol period (.) is counted in the size of the data item described by the PICTURE character-string.

Note: For a given program the functions of the period and comma are exchanged if the DECIMAL-POINT IS COMMA clause 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.

+, –, CR, DB
These symbols are used as editing sign control symbols.When used, they represent the character position into which the editing sign control symbol will be placed.The symbols are mutually exclusive in any one PICTURE character-string and each character used in the symbol is counted in determining the size of the data item described by the PICTURE character-string. If the symbols plus or minus occur more than once (a floating sign control symbol), then one less than the total number of these symbols is counted in determining the maximum number (30) of digit positions allowed in a numeric edited data item.If a floating symbol plus or minus is used to the right of the decimal point in a character-string, then all digit positions in that character-string must be described with the symbol plus or minus, respectively. If a floating plus or minus symbol string represents all the digit-positions in the character-string, then the described data item is blank when zero, even if the BLANK WHEN ZERO clause is not specified.

* Each symbol asterisk (*) in the character-string represents a leading numeric character position into which a character asterisk (“*”) will be placed when that position contains a leading zero and the data item is the receiving item of an elementary MOVE statement. Each symbol asterisk (*) is counted in the size of the data item described by the PICTURE character-string and in determining the maximum number (30) of digit positions allowed in a numeric edited data item. If the symbol asterisk (*) is used to the right of the decimal point in a character-string, then all digit positions in that character-string must be described with the symbol asterisk (*). The symbol asterisk in the PICTURE character-string and the BLANK WHEN ZERO clause may not occur in the same data description entry. If the symbol asterisk represents all the digit-positions in the character-string, then, when zero, the described data item is all asterisks (ALL “*”), except that, if the character string contains the symbol period (.), a character period (“.”) will occur at the specified location in the data item.

cs The currency symbol in a character-string is represented either by the currency sign (the symbol $) or by the single character specified in the CURRENCY SIGN clause in the SPECIAL-NAMES paragraph. The currency symbol in the character-string represents a character position into which a currency symbol is to be placed when the data item is the receiving item of an elementary MOVE statement. Each currency symbol is counted in the size of the data item described by the PICTURE character-string. If the currency symbol occurs more than once (a floating currency symbol), then one less than the total number of currency symbols is counted in determining the maximum number (30) of digit positions allowed in a numeric edited data item. If the currency symbol is used to the right of the decimal point in a character-string, then all digit positions in that character-string must be described with the currency symbol. If a floating currency symbol string represents all the digit-positions in the character-string, then the described data item is blank when zero, even if the BLANK WHEN ZERO clause is not specified.

Editing Rules

There are two general methods of performing editing in the PICTURE clause, either by insertion or by suppression and replacement. There are four types of insertion editing available:

  1. Simple insertion
  2. Special insertion
  3. Fixed insertion
  4. Floating insertion

There are two types of suppression and replacement editing:

  1. Zero suppression and replacement with spaces
  2. Zero suppression and replacement with asterisks

The type of editing which may be performed upon a data item depends on the category to which the data item belongs.Table specifies which type of editing may be performed upon a given category.

PICTURE Clause Editing

PICTURE Clause Editing

Floating insertion editing and editing by zero suppression and replacement are mutually exclusive in a PICTURE clause.Only one type of replacement may be used with zero suppression in a PICTURE clause.

Simple Insertion Editing

The symbols comma (,), B, 0, and slash (/) are used as the insertion characters. The insertion characters are counted in the size of the item and represent the position in the item into which the character will be inserted.

Special Insertion Editing

The symbol period (.) is used as the insertion character.It also represents the decimal point for alignment purposes.The insertion character used for the actual decimal point is counted in the size of the item.The use of the assumed decimal point—represented by the symbol V —and the actual decimal point, represented by the insertion symbol period (.), in the same PICTURE character-string is disallowed.The result of special insertion editing is the appearance of the insertion character in the item in the same position as shown in the character-string.

Fixed Insertion Editing

The currency symbol and the editing sign control symbols plus (+), minus (), CR, and DB are the insertion characters. Only one currency symbol and only one of the editing sign control symbols can be used in a given PICTURE character-string. When the symbols CR and DB are used, they represent two character positions in determining the size of the item, and they must represent the rightmost character positions that are counted in the size of the item. If these character positions contain the symbols CR orDB, the uppercase letters are the insertion characters.

A plus (+) or minus () symbol, when used, must be either the leftmost or rightmost character position to be counted in the size of the item.

The currency symbol must be the leftmost character position to be counted in the size of the item except that it can be preceded by either a plus (+) or a minus () symbol.

Fixed insertion editing results in the insertion character occupying the same character position in the edited item as it occupied in the PICTURE character-string.

Editing sign control symbols produce the results shown in Table depending upon thevalue of the data item.

Editing Symbol Results

Editing Symbol Results

Floating Insertion Editing

The currency symbol and editing sign control symbols plus (+) and minus () are the floating insertion characters and as such are mutually exclusive in a given PICTURE character-string.

Floating insertion editing is indicated in a PICTURE character-string by using a string of at least two of the floating insertion characters.The string may contain any of the simple insertion symbols or have simple insertion characters immediately to its right.Such simple insertion characters are part of the floating string.When the floating insertion character is the currency symbol, the string of floating insertion characters may have the fixed insertion characters CR and DB immediately to the right of the string.

The leftmost character of the floating insertion string represents the leftmost limit of the floating symbols in the data item. The rightmost character of the floating string represents the rightmost limit of the floating symbols in the data item.

The second floating character from the left represents the leftmost limit of the numeric data that can be stored in the data item.Nonzero numeric data may replace all the characters at or to the right of this limit.

In a PICTURE character-string, there are only two ways of representing floating insertion editing.One way is to represent any or all of the leading numeric character positions on the left of the decimal point by the insertion character.The other way is to represent all of the numeric character positions in the PICTURE character-string by the insertion character.

If the insertion characters are only to the left of the decimal point in the PICTURE character-string, the result is that a single floating insertion character will be placed into the character position immediately preceding either the decimal point or the first nonzero digit in the data represented by the insertion symbol string, whichever is farther to the left in the PICTURE character-string.The character positions preceding the insertion character are replaced with spaces.

If all numeric character positions in the PICTURE character-string are represented by the insertion character, at least one of the insertion characters must be to the left of the decimal point.

When the floating character is the editing control symbol plus (+) or minus (), the character inserted depends upon the value of the data item;

Results of + and – Editing

Results of   and – Editing

If all numeric character positions in the PICTURE character-string are represented by the insertion character, the result depends upon the value of the data.If the value is zero, the entire data item will contain spaces.If the value is not zero, the result is the same as when the insertion character is only to the left of the decimal point.

To avoid truncation, the minimum size of the PICTURE character-string for the receiving data item must be the number of characters in the sending data item, plus the number of nonfloating insertion characters being edited into the receiving data item, plus one for the floating insertion character.

Zero Suppression Editing

The suppression of leading zeroes in numeric character positions is indicated by the use of the symbol Z or by the symbol asterisk ( *) as suppression symbols in a PICTURE character-string.These symbols are mutually exclusive in a given PICTURE character-string. Each suppression symbol is counted in determining the size of the item. If Z is used, the replacement character will be the space; if the asterisk is used, the replacement character will be *.

Zero suppression and replacement are indicated in a PICTURE character-string by using a string of one or more of the allowable symbols to represent leading numeric character positions which are to be replaced when the associated character position in the data contains a leading zero.Any of the simple insertion characters embedded in the string of symbols or to the immediate right of this string are part of the string.

In a PICTURE character-string, there are only two ways of representing zero suppression.One way is to represent any or all of the leading numeric character positions to the left of the decimal point by suppression symbols.The other way is to represent all of the numeric character positions in the PICTURE character-string by suppression symbols.

If the suppression symbols appear only to the left of the decimal point, any leading zero in the data, which corresponds to a symbol in the string, is replaced by the replacement character.

Suppression terminates at the first nonzero digit in the data represented by the suppression symbol string or at the decimal point, whichever is encountered first.

If all numeric character positions in the PICTURE character-string are represented by suppression symbols and the value of the data is not zero, the result is the same as if the suppression characters were only to the left of the decimal point.If the value is zero and the suppression symbol is Z , the entire data item, including any editing characters, is spaces.If the value is zero and the suppression symbol is asterisk ( * ), the entire data item, including any insertion editing symbols except the actual decimal point, is “*”.In this case, the actual decimal point will appear in the data item.

The symbols plus (+), minus (), asterisk (*), Z, and the currency symbol, when used as floating replacement characters, are mutually exclusive within a given character-string.

PICTURE Symbol Precedence

Table shows the order of precedence when using characters as symbols in a PICTURE character-string. An “X” at an intersection indicates that the symbol (or symbols) at the top of the column may precede (but not necessarily immediately), in a given character-string, the symbol (or symbols) at the left of the row. Arguments listed as one or another (for instance, plus (+) or minus ()) indicate mutually exclusive symbols. The currency symbol is indicated by the symbol cs.

At least one of the symbols A, X, Z, 9 or asterisk (*), or at least two occurrences of one of the symbols plus (+), minus (), or cs must be present in a PICTURE character-string.

The nonfloating insertion symbols plus (+) and minus (), the floating insertion symbols Z, asterisk (*), plus (+), minus (), and csand the symbol P appear twice in Table. The first appearance of the symbol in the FIRST SYMBOL column and SECOND SYMBOL row represents its use to the left of the decimal point position. The second appearance of the symbol represents its use to the right of the decimal point position.

PICTURE Symbol Precedence

PICTURE Symbol Precedence

REDEFINES Clause

REDEFINES Clause

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

Note:level-number-1, data-name-1 and FILLER are shown in the above format (gray highlight) to improve clarity.They are not part of the REDEFINES clause.

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

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

The data description entry for data-name-2 cannot contain an OCCURS clause. However, data-name-2 may be subordinate to an item whose data description contains an OCCURS clause.In this case, the reference to data-name-2 in the REDEFINES clause may not be subscripted. Neither the original definition nor the redefinition can include a variable-occurrence data item.

data-name-2 must not be qualified; if it is not a unique data-name, the necessary qualification is implicitly provided by the position of the REDEFINES clause within the hierarchical structure of the Data Division.

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

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

When the level-number of data-name-1 is other than 01, it must not specify more character positions than the data item referenced by data-name-2 contains.It is important to observe that the REDEFINES clause specifies the redefinition of a storage area, not of the data items occupying the area.

Multiple redefinitions of the same character positions are permitted.When multiple redefinitions are used, either the first or the most recently defined name on the same level within the current hierarchy may be used as data-name-2.

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

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

RENAMES Clause

RENAMES Clause

The RENAMES clause permits alternative, possibly overlapping, groupings of elementary items.

Note:Level-number 66 and data-name-1, and the period space separator are shown in the above format (gray highlight) to improve clarity.They are not part of the RENAMES clause.

All RENAMES entries referring to data items within a given logical record must immediately follow the last data description entry of the associated record description entry.

data-name-2 and data-name-3 must be names of elementary items or groups ofelementary items in the same logical record, and cannot be the same data-name. A 66 level entry cannot rename another 66 level entry nor can it rename a 77, 88 or 01 level entry.

data-name-1 cannot be used as a qualifier, and can only be qualified by the names of the associated level 01, FD, CD, or SD entry.Neither data-name-2 nor data-name-3 may have an OCCURS clause in its data description entry nor be subordinate to an item that has an OCCURS clause in its data description entry.

The beginning of the area described by data-name-3 must not be to the left of the beginning of the area described by data-name-2.The end of the area described by data-name-3 must be to the right of the end of the area described by data-name-2. data-name-3, therefore, cannot be subordinate to data-name-2.

data-name-2 and data-name-3 may be qualified.

None of the items within the range, including data-name-2 and data-name-3, if specified, can be variable-occurrence data items.

One or more RENAMES entries can be written for a logical record.

When data-name-3 is not specified, all of the data attributes of data-name-2 become the data attributes for data-name-1, and data-name-1 may be used as a synonym for data-name-2.

When data-name-3 is specified, data-name-1 is defined as a group item that includes all elementary items starting with data-name-2 (if data-name-2 is an elementary item) or the first elementary item in data-name-2 (if data-name-2 is a group item), and concluding with data-name-3 (if data-name-3 is an elementary item) or the last elementary item in data-name-3 (if data-name-3 is a group item).

The words THRU and THROUGH are synonymous.

SIGN Clause

SIGN Clause

The SIGN clause specifies the position and the mode of representation of the operational sign when it is necessary to describe these properties explicitly.

The SIGN clause may be used to specify the position and mode of representation of the operational sign for signed numeric data items.It may be specified either at the elementary level or at the group level.When it is specified at the elementary level, it applies only to that item.When it is specified at the group level, it applies to each subordinate signed numeric data item.

If a SIGN clause is specified in a group item subordinate to another group item that also has a SIGN clause, the SIGN clause specified in the subordinate group item takes precedence for that subordinate group item.

If a SIGN clause is specified in an elementary numeric data description entry subordinate to a group item for which a SIGN clause is specified, the SIGN clause specified in the subordinate elementary numeric data description entry takes precedence for that elementary numeric data item.

The SIGN clause is applicable only to numeric data description entries whose PICTURE character-string contains the symbol S and whose explicit or implicit usage is DISPLAY. If the CODE-SET clause is specified, any signed numeric data description entries associated with that file description entry must be described with the SIGN IS SEPARATE clause.

A numeric data description entry whose PICTURE character-string contains the character S, but to which no optional SIGN clause applies, has an operational sign whose representation depends on the presence of the optional NUMERIC SIGN clause in the Special-Names paragraph.If the NUMERIC SIGN clause is specified in the Special-Names paragraph, the operational sign representat



Face Book Twitter Google Plus Instagram Youtube Linkedin Myspace Pinterest Soundcloud Wikipedia

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

COBOL Topics