Rational Developer for System z
Enterprise COBOL for z/OS, Version 4.1, Language Reference


Data categories and PICTURE rules

The allowable combinations of PICTURE symbols determine the data category of the item:

Note: Category internal floating point is defined by a USAGE clause that specifies the COMP-1 or COMP-2 phrase.

Alphabetic items

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

The content of the item must consist only of letters of the Latin alphabet and the space character.

Other clauses

USAGE DISPLAY must be specified or implied.

Any associated VALUE clause must specify an alphanumeric literal containing only alphabetic characters, SPACE, or a symbolic-character as the value of a figurative constant.

Numeric items

Types of numeric items are:

  • Binary
  • Packed decimal (internal decimal)
  • Zoned decimal (external decimal)
  • National decimal (external decimal)

The type of a numeric item is defined by the usage clause as shown in the table below.

Table 1. Numeric types
Type USAGE clause
Binary BINARY, COMP, COMP-4, or COMP-5
Internal decimal PACKED-DECIMAL, COMP-3
Zoned decimal (external decimal) DISPLAY
National decimal (external decimal) NATIONAL

For numeric date fields, the PICTURE character-string can contain only the symbols 9 and S. For all other numeric fields, the PICTURE character-string can contain only the symbols 9, P, S, and V.

The symbol S can be written only as the leftmost character in the PICTURE character-string.

The symbol V can be written only once in a given PICTURE character-string.

For binary items, the number of digit positions must range from 1 through 18 inclusive. For packed decimal and zoned decimal items the number of digit positions must range from 1 through 18, inclusive, when the ARITH(COMPAT) compiler option is in effect, or from 1 through 31, inclusive, when the ARITH(EXTEND) compiler option is in effect.

For numeric date fields, the number of digit positions must match the number of characters specified by the DATE FORMAT clause.

If unsigned, the contents of the item in standard data format must contain a combination of the Arabic numerals 0-9. If signed, it can also contain a +, -, or other representation of the operational sign.

Examples of valid ranges

 PICTURE   Valid range of values
   9999     0 through 9999
    S99    -99 through +99
 S999V9    -999.9 through +999.9
 PPP999     0 through .000999
S999PPP    -1000 through -999000 and
           +1000 through +999000 or zero

Other clauses

The USAGE of the item can be DISPLAY, NATIONAL, BINARY, COMPUTATIONAL, PACKED-DECIMAL, COMPUTATIONAL-3, COMPUTATIONAL-4, or COMPUTATIONAL-5.

For signed numeric items described with usage NATIONAL, the SIGN IS SEPARATE clause must be specified or implied.

The NUMPROC and TRUNC compiler options can affect the use of numeric data items. For details, see the Enterprise COBOL Programming Guide.

Numeric-edited items

The PICTURE character-string can contain the following symbols:

B  P  V  Z  9  0  /  ,  .  +  -  CR  DB  *  cs

The combinations of symbols allowed are determined from the PICTURE clause symbol order allowed (see the figure in Symbols used in the PICTURE clause), and the editing rules (see PICTURE clause editing).

The following rules apply:

  • Either the BLANK WHEN ZERO clause must be specified for the item, or the string must contain at least one of the following symbols:
    B  /  Z  0  ,  .  *  +  -  CR  DB  cs
  • Only one of the following symbols can be written in a given PICTURE character-string:
    +  -  CR  DB
  • If the ARITH(COMPAT) compiler option is in effect, then the number of digit positions represented in the character-string must be in the range 1 through 18, inclusive. If the ARITH(EXTEND) compiler option is in effect, then the number of digit positions represented in the character-string must be in the range 1 through 31, inclusive.
  • The total number of character positions in the string (including editing-character positions) must not exceed 249.
  • The contents of those character positions representing digits in standard data format must be one of the 10 Arabic numerals.

Other clauses

USAGE DISPLAY or NATIONAL must be specified or implied.

If the usage of the item is DISPLAY, any associated VALUE clause must specify an alphanumeric literal or a figurative constant. The value is assigned without editing.

If the usage of the item is NATIONAL, any associated VALUE clause must specify an alphanumeric literal, a national literal, or a figurative constant. The value is assigned without editing.

Alphanumeric items

The PICTURE character-string must consist of either of the following:

  • One or more occurrences of the symbol X.
  • Combinations of the symbols A, X, and 9. (A character-string containing all As or all 9s does not define an alphanumeric item.)

The item is treated as if the character-string contained only the symbol X.

The contents of the item in standard data format can be any allowable characters from the character set of the computer.

Other clauses

USAGE DISPLAY must be specified or implied.

Any associated VALUE clause must specify an alphanumeric literal or one of the following figurative constants:

  • ZERO
  • SPACE
  • QUOTE
  • HIGH-VALUE
  • LOW-VALUE
  • symbolic-character
  • ALL alphanumeric-literal

Alphanumeric-edited items

The PICTURE character-string can contain the following symbols:

A  X  9  B  0  /

The string must contain at least one A or X, and at least one B or 0 (zero) or /.

The contents of the item in standard data format must be two or more characters from the character set of the computer.

Other clauses

USAGE DISPLAY must be specified or implied.

Any associated VALUE clause must specify an alphanumeric literal or or one of the following figurative constants:

  • ZERO
  • SPACE
  • QUOTE
  • HIGH-VALUE
  • LOW-VALUE
  • symbolic-character
  • ALL alphanumeric-literal

The literal is treated exactly as specified; no editing is done.

DBCS items

The PICTURE character-string can contain the symbols G, G and B, or N. Each G, B, or N represents a single DBCS character position.

Any associated VALUE clause must contain a DBCS literal, the figurative constant SPACE, or the figurative constant ALL DBCS-literal.

Other clauses

When PICTURE symbol G is used, USAGE DISPLAY-1 must be specified. When PICTURE symbol N is used and the NSYMBOL(DBCS) compiler option is in effect, USAGE DISPLAY-1 is implied if the USAGE clause is omitted.

National items

The PICTURE character-string can contain one or more occurrences of the picture symbol N.

These rules apply when the NSYMBOL(NATIONAL) compiler option is in effect or the USAGE NATIONAL clause is specified. In the absence of a USAGE NATIONAL clause, if the NSYMBOL(DBCS) compiler option is in effect, picture symbol N represents a DBCS character and the rules of the PICTURE clause for a DBCS item apply.

Each N represents a single national character position.

Any associated VALUE clause must specify an alphanumeric literal, a national literal, or one of the following figurative constants:

  • ZERO
  • SPACE
  • QUOTE
  • HIGH-VALUE
  • LOW-VALUE
  • symbolic-character
  • ALL alphanumeric-literal
  • ALL national-literal

Other clauses

Only the NATIONAL phrase can be specified in the USAGE clause. When PICTURE symbol N is used and the NSYMBOL(NATIONAL) compiler option is in effect, USAGE NATIONAL is implied if the usage clause is omitted.

The following clauses can be used:

  • JUSTIFIED
  • EXTERNAL
  • GLOBAL
  • OCCURS
  • REDEFINES
  • RENAMES
  • SYNCHRONIZED

The following clauses cannot be used:

  • BLANK WHEN ZERO
  • SIGN
  • DATE FORMAT

National-edited items

The PICTURE character-string must contain the following:

  • At least one symbol N, and
  • At least one of the symbols B 0 (zero) or / (slash)

Each symbol represents a single national character position.

Any associated VALUE clause must specify an alphanumeric literal, a national literal, or one of the following figurative constants:

  • ZERO
  • SPACE
  • QUOTE
  • HIGH-VALUE
  • LOW-VALUE
  • symbolic-character
  • ALL alphanumeric-literal
  • ALL national-literal

The literal is treated exactly as specified; no editing is done.

The NSYMBOL(NATIONAL) compiler option has no effect on the definition of a data item of category national-edited.

Other clauses

USAGE NATIONAL must be specified or implied.

The following clauses can be used:

  • JUSTIFIED
  • EXTERNAL
  • GLOBAL
  • OCCURS
  • REDEFINES
  • RENAMES
  • SYNCHRONIZED

The following clauses cannot be used:

  • BLANK WHEN ZERO
  • SIGN
  • DATE FORMAT

External floating-point items

Read syntax diagramSkip visual syntax diagram
Format

>>-+-+--+--mantissaE--+-+--+--exponent-------------------------><
   '- --'             '- --'             

+ or -
A sign character must immediately precede both the mantissa 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.

mantissa
The mantissa 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 mantissa; the decimal point can be leading, embedded, or trailing.

The mantissa can contain from 1 to 16 numeric characters.

E
Indicates the exponent.
exponent
The exponent must consist of the symbol 99.

Example: Pic -9v9(9)E-99

The DISPLAY phrase of the USAGE clause and a floating-point picture character-string define the item as a display floating-point data item.

The NATIONAL phrase of the USAGE clause and a floating-point picture character-string define the item as a national floating-point data item.

For items defined with usage DISPLAY, each picture symbol except V defines one alphanumeric character position in the item.

For items defined with usage NATIONAL, each picture symbol except V defines one national character position in the item.

Other clauses

The DISPLAY phrase or the NATIONAL phrase of the USAGE clause must be specified or implied.

The OCCURS, REDEFINES, and RENAMES clauses can be associated with external floating-point items.

The SIGN clause is accepted as documentation and has no effect on the representation of the sign.

The SYNCHRONIZED clause is treated as documentation.

The following clauses are invalid with external floating-point items:

  • BLANK WHEN ZERO
  • JUSTIFIED
  • VALUE

Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)