Skip to content

Value Clause

This clause may be used whenever the report field to be output consists of a fixed literal value.

value

Value Clause: Coding Rules

  • You may specify a numeric or non-numeric literal, including a figurative constant, or a DBCS literal. An ANS-85 SYMBOLIC CHARACTER is also permitted.

  • Unless you specify ALL or a figurative constant, you do not need a PICTURE clause. For example: 05 COL 21 VALUE "*** ALL-IN SPORTS CLUB ***".

    You may use 'apostrophes' instead of "quotes" if your current compiler options expect them. The Precompiler accepts either delimiter at the start of a literal, scanning for the same delimiter to close the literal. Continued literals are also permitted. As usual, two quotes juxtaposed within a "literal" signify a single quote as part of the value, and similarly for apostrophe.

  • You may use the ALL "literal" form or a numeric literal or figurative constant, but in all these cases you must specify a PICTURE. Here is an easy method of coding a repeated value: 05 COL 1 PIC X(24) VALUE ALL "XOX". Which gives you the repeated pattern: XOXXOXXOXXOXXOXXOXXOX.

  • If the item is defined as DBCS by virtue of its PICTURE clause or USAGE DISPLAY-1 clause, the literal must also be DBCS. However a PICTURE clause is not required, a PICTURE of G(n) where n is the number of double bytes being assumed in default.

  • Any literal may also be hexadecimal. However, it is inadvisable to use this facility to insert printer control characters into your print data, since these will (a) make your program non-portable and unreadable (b) put your COLUMN positions out of alignment. The STYLE clause is designed specifically for this purpose and has none of these drawbacks. (See STYLE clause.)

Value Clause: Operation

  • The VALUE clause results in the specified fixed literal appearing in your report field. Assuming that your program does not alter the value by overwriting the report field procedurally (which it can do if the field is named), the value will be unchanged throughout the report.

  • Report writer will either "pre-set" (fill in) your report field with the specified literal at compile time; or it may move the literal into the report field at run time, in cases where the report field is in a variable position, or where the report line cannot hold pre-set values because it is subject to an OCCURS clause.

  • If the item is DBCS, it is stored in the report line with each double-byte character occupying one column position. (See USAGE clause.)

Multiple Values

If you use the multiple form of the VALUE clause, by writing more than one literal after the keyword, it will save you the effort of coding several separate entries. Note the following:

  • If you wish to place no value in a particular occurrence, you may simply code a space character: " ".

  • Your entry must be subject to at least one of the following:

    • A fixed OCCURS clause (not OCCURS...DEPENDING), or
    • A multiple LINES clause, or
    • A multiple COLUMNS clause.
  • All the literals must be either DBCS or non-DBCS.

  • The rule for the number of literals allowed in your multiple VALUE is similar to that of the multiple SOURCES clause (see 3.21.4 Multiple SOURCES); that is, it must exactly equal either the total number of repetitions in all the dimensions of the entry, or the product of the numbers of repetitions of one or more of the inner dimension(s). For example, with the following layout:

      03 LINE OCCURS 2. 
       04 OCCURS 3. 
        05 COLS +3, +3, +3, +1 VALUES ARE .....    
    
    the number of literals should be either 4 (just the inner dimension), 12 (the product of the inner two dimensions), or 24 (all the dimensions).

  • If the literals cover more than one dimension, they are distributed along the innermost dimension, periodically stepping to the next entry in one or more outer dimensions. For example:

    value one dimension

  • If there are two or more dimensions and the number of terms matches only the inner dimension(s), the series of literals is re-cycled from the first operand for each of the outer repetitions. For example, the following case:

    value two dimensions

  • The multiple VALUE operand may be used as one or more of the alternatives in a multiple-choice entry. You need not use a multiple VALUE in every alternative:

    value multiple

  • If, as is usual, you omit a PICTURE clause, the size of each field is the size of its corresponding literal, as seen in the following example: 05 COLS 1 +2 +2 VALUES "CAESAR" "QUELLED" "VERCINGETORIX"., which yields:

    caesar quelled

    This is also true of multiple-choice entries.

  • In all cases, you may omit the VALUE keyword.

  • Other examples of the multiple VALUE clause will be found under Multiple COLUMNS Clause and Multiple LINES Clause.

Compatibility

Only new Report Writer provides the following features:

  • The VALUE keyword being optional,
  • DBCS and hexadecimal literals in the REPORT SECTION,
  • PICTURE clause being optional with a non-numeric literal,
  • The multiple VALUE format.
Back to top