The PICTURE Clause

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

General Format


*

Syntax Rules

  1. A PICTURE clause can be specified only at the elementary item level.
  2. 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.
  3. The maximum number of characters allowed in the character-string is 30.

    ISO2002MFOS390 The maximum number of characters allowed in the character-string is 50.

  4. The PICTURE clause must not be specified for the subject of a RENAMES clause.
  5. PIC is an abbreviation for PICTURE.
  6. The asterisk when used as the zero suppression symbol and the clause BLANK WHEN ZERO should not appear in the same entry.

    OSVS This construct is, however, permitted, in which case zero suppression overrides the BLANK WHEN ZERO clause.

  7. An integer in parentheses following a character indicates that the character is repeated the number of times shown by the integer.

General Rules

The categories of data that can be described with a PICTURE clause are: alphabetic, numeric, alphanumeric, alphanumeric edited, numeric edited,

OSVSVSC2MF  external floating-point,

ISO2002MF and boolean.

General rules within these categories are given below:

Alphabetic Data Rules

  1. The PICTURE character-string can contain only the symbols "A" and "B".

    ANS85 The PICTURE character-string can contain only the symbol "A".

  2. The contents when represented in standard data format must be one or more alphabetic characters.

Numeric Data Rules

  1. The PICTURE character-string can contain only the symbols "9", "P", "S", and "V", and can contain up to 18 digit positions; or:

    ISO2002OS390 The PICTURE character-string can contain up to 31 digit positions; or:

    MF The PICTURE character-string can contain up to 38 digit positions.

  2. If unsigned, the data in standard data format must be a combination of the Arabic numerals "0", "1", "2", " 3", "4", "5", "6", "7", "8", and "9"; if signed, the item can also contain a "+", "-", or other representation of an operational sign. (See the topic The SIGN Clause.)

Alphanumeric Data Rules

  1. The PICTURE character-string is restricted to certain combinations of the symbols " A", "X", "9", and the item is treated as if the character-string contained all X"s. A PICTURE character-string which contains all A"s or all 9"s does not define an alphanumeric item.
  2. The contents when represented in standard data format can consist of any characters in the computer's character set.

Alphanumeric Edited Data Rules

  1. The PICTURE character-string is restricted to certain combinations of the following symbols: "A", "X", " 9", "B", "0", and "/" as follows:
    1. The character-string must contain at least one "B" and at least one "X" or at least one "0" (zero) and at least one "X" or at least one "/" (slash) and at least one "X", or:
    2. The character-string must contain at least one "0" (zero) and at least one "A" or at least one "/" (slash) and at least one "A".
  2. The contents when represented in standard data format can consist of any characters in the computer's character set.

Numeric Edited Data Rules

  1. The PICTURE character-string is restricted to certain combinations of the symbols "B", "/", "P", "V" , "Z", "0", "9", ",", ".", "*", "+", "-", "CR", "DB", and the currency symbol. The allowable combinations are determined from the order of precedence of symbols and the editing rules as follows:
    1. The PICTURE character-string can contain up to 18 digit positions; or:

      ISO2002OS390 The PICTURE character-string can contain up to 31 digit positions; or:

      MF The PICTURE character-string can contain up to 38 digit positions.

    2. The character-string must contain at least one "0" , "B", "/", "Z", "*", "+", ",", ".", "-", "CR" , "DB", or currency symbol.
  2. The contents of the character positions that represent a digit must be one of the numerals.
  3. If all character positions in the PICTURE character-string are represented by an insertion character, at least one of the insertion characters must be positioned to the left of the decimal point.
OSVSVSC2MF 

External Floating-point Data Items

  1. The PICTURE string must have the following form:


    *

    A sign character must immediately precede both the significand and the exponent.

    A "+" sign indicates that a positive sign will be used in the output to represent positive values and that a negative sign will represent negative values.

    A "-"sign indicates that a blank will be used in the output to represent positive values and that a negative sign will represent negative values.

    Each sign position occupies one byte of storage.

    significand

    The significand can contain the symbols:

    9 . V

    An actual decimal point can be represented with a period while an assumed decimal point is represented by a V. Either an actual or an assumed decimal point must be present in the significand; the decimal point can be leading, embedded or trailing. The significand can contain from 1 to 16 numeric characters.

    E

    Indicates the exponent.

    exponent

    The exponent must be a PIC "99".

  2. The OCCURS, REDEFINES and RENAMES clauses can be associated with external floating-point items.
  3. The SIGN clause is documentary only and has no effect on the representation of the sign.
  4. The SYNCHRONIZED clause is documentary only.
  5. The following clauses are invalid with external floating-point items:

    BLANK WHEN ZERO JUSTIFIED VALUE

Boolean Data Rules

  1. The PICTURE character-string can contain only the symbol "1".
  2. The PICTURE character-string can contain up to 64 digit positions.
  3. Values can be specified in literals with an opening separator B", for example B"1110", where the value is expressed as bits.

Comments:

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 integer which is enclosed in parentheses following the symbols "A", ",", "X" , "9", "P", "Z", "*", "B", "/", "0", "+", "-", or the currency symbol indicates the number of replications of the symbol. Note that the following symbols can appear only once in a given PICTURE: "S" , "V", ".", "CR", and "DB",

OSVSVSC2MF "E".

The functions of the symbols used to describe an elementary item are explained as follows:

A Each "A" in the character-string represents a character position which can contain only a letter of the alphabet or a space.
B Each "B" in the character-string represents a character position into which the space character will be inserted.
OSVSVSC2MF  E Marks the start of the exponent in an external floating-point item. The exponent occupies 1 byte of storage at run time.
P Each "P" 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 character "P" is not counted in the size of the data item. Scaling position characters are counted in determining the maximum number of digit positions in numeric edited items or numeric items. The scaling position character "P" can appear only to the left or right as a continuous string of "P"s within a PICTURE description; since the scaling position character "P" implies an assumed decimal point (to the left of "P" s if "P"s are leftmost PICTURE characters and to the right if "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 insertion character "." (period) cannot both occur in the same PICTURE character-string. 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.

ANS85 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 position 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:

  1. Any operation requiring a numeric sending operand.
  2. An elementary MOVE statement where the sending operand is numeric and its PICTURE character-string contains the symbol "P".
  3. A MOVE statement where the sending operand is numeric edited and its PICTURE character-string contains the symbol "P" and the receiving operand is numeric or numeric edited.
  4. A comparison operation where both operands are numeric.

ANS85 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 letter "S" is used in a character-string to indicate the presence, but neither the representation nor, necessarily, the position of an operational sign; it must be written as the leftmost character in the PICTURE. The "S" 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 which specifies the optional SEPARATE CHARACTER phrase. (See the topic The SIGN Clause.)
V The letter "V" is used in a character-string to indicate the location of the assumed decimal point and can 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.
X Each "X" in the character-string is used to represent a character position which contains any allowable character from the computer's character set.
Z Each "Z" in a character-string can only be used to represent the leftmost numeric character positions which will be replaced by a space character when the contents of that character position is zero. Each "Z" is counted in the size of the item.
9 Each "9" in the character-string represents a character position which contains a numeral and is counted in the size of the item.
0 Each "0" (zero) in the character-string represents a character position into which the numeral zero will be inserted. The "0" is counted in the size of the item.
/ Each "/" (slash) in the character-string represents a character position into which the slash character will be inserted. The "/" is counted in the size of the item.
, Each "," (comma) in the character-string represents a character position into which the character "," will be inserted. This character position is counted in the size of the item. The insertion character "," must not be the last character in the PICTURE character-string.