SET (assign a value)


SET, in combination with the = operator, assigns a value (characters or numerics) to a variable.

It can be used to specify report headings and the contents of variables and to control the printing of the report.

Syntax

 SET variable = expression

where

  • variable is a symbolic variable. The symbolic variable can be predefined or user-defined. A user-defined variable must start with an alphabetic character, can be up to eight characters long, and can comprise any alphanumeric character. It can be preceded by an ampersand (&) to distinguish it from a literal.
  • expression can be variables, whole numbers, or character strings alone or in combination with operators. For more information, see Expressions-and-operators.

A value that was assigned to a variable before a SELECT statement does not change.

Usage

When the variable being set is used with DETAIL, SUMMARY, or USING statements, a DEFINE statement should be inserted before the SET statement.

A symbolic variable can be set to

  • The value of another variable, which can be symbolic or predefined. For more information, see Predefined-variables.

    SET WEEK = &DAYS

    Note

    Ampersand (&) is a reserved word and should not be used as a variable value. In other words, &a is a variable while & or && is not.

  • A character string

    Enclose characters in single quotation marks. Begin a variable inside quotation marks with an ampersand. Use a period to delimit a variable from a literal. The characters can be a direct substitute for the variable, a substring, or concatenated with other variables, as shown in the following examples:

    Example 1: Substitution

    In this example, ABCDEF is substituted for the symbolic variable, ALPHA:

    SET ALPHA = 'ABCDEF'

    Example 2: Substring

    In this example, B is assigned to the symbolic variable, BETA. The substring expression specifies that the second character of the string be substituted for &ALPHA, for a length of one character.

    SET BETA = &ALPHA(2:1)

    Example 3: Concatenation

    Character strings can be concatenated with other variables and literals. Identify variables with an ampersand prefix and add a period at the end of the variable to delimit it from a literal, as follows:

    SET ALPHA = 'A'
    SET DELTA = 'DEF'
    SET AD    = '&ALPHA.BC&DELTA'

    The AD variable is assigned a value of ABCDEF.

    If an ampersand prefix or a period suffix is not used to delimit the variables from the literals, the characters are assigned to the AD variable. An example follows:

    SET AD    = 'ALPHABCDELTA'

    In the preceding example, the AD variable is assigned a value of ALPHABCDELTA.

  • A numeric integer to be used as a counter

    For decimal arithmetic, use the COMPUTE verb.

    SET DAYS = 7

    A number can be an integer from 0 to 9. The number can have one decimal point, a sign, or commas, but it cannot contain any blank characters or be enclosed in single quotation marks.

    A numeric value also can be assigned to a variable as a counter. The number of digits is initially set to 00000 as a default. When 99999 is reached, the value resets to 00000. The default digits can be changed with the SET statement. For example, SET number = 01 establishes a two-digit counter that, at 99, resets to 00. An example follows:

    SET NUMBER = 01
    SET V1 = V2 + NUMBER

    Note

    SET does not keep track of decimals or signs.

Report output can be set as follows (all specified values must be enclosed in single quotation marks):

  • CASE specifies that the output characters be in uppercase or mixed case. The default is uppercase. SET CASE must precede other PRL statements and is written as
SET CASE = 'MIXED'
SET CASE = 'UPPER'
  • CLASS specifies the output class for the report. It is a 1-byte, site-defined character. A is the default.

    Note

    Report output also can be allocated with a DD statement, as described in Routing-report-output, that has the same name as the value of SET REPORTID.

  • FORM specifies four characters defining the type of paper on which the report is to be printed. STD is the default.

    Note

    Instead of specifying SET FORM, a DD allocation that has the same name as the value of SET REPORTID can specify the form type.

  • LINES specifies the report page length. The default is 50 lines. The minimum value is 001 and the maximum value is 255.
  • REPORTID specifies a 1- to 8-character alphanumeric ID for the report. The ID is in the upper left corner of the report. The execution job name is the default.

    If a DD output allocation has the same name as the user-specified value for REPORTID, the report is allocated to the DD output, as described in Routing-report-output.

  • TITLE specifies the first of four lines to be generated by PRL on every page. Specify any alphanumeric string up to a maximum of 80 characters. The default is MainView for CICS. The title is centered automatically at the top of each page.
  • TITLE1 and TITLE2 specify a subtitle for the second line (TITLE1) or third line(TITLE2) of every page. The subtitle length is 80 characters. Each specified subtitle is centered automatically at the top of each page. Blank is the default.
  • WIDTH specifies the width of the report title. The default is 132 print positions. From 32 to 255 print positions can be specified for your report. Report titles are adjusted to the specified width. The USING statement determines the column data to be reported. The reported data is truncated if it does not fit within the specified width. If USING specifies only a few variables and the WIDTH is at a large value, the column data is reported as formatted by the PNLLIB data dictionary. It is not adjusted to the specified WIDTH value.
  • ZHEADING specifies the print characteristics of the column headings of PRL tabular reports. If ZHEADING is not specified, the default prints each column heading three times without a carriage return. The default should be used with line printers to create bold text in the column headings by printing each word three times.

    Use ZHEADING = 'SINGLE' to create viewable online reports. Use ZHEADING = 'NONE' to create PRL reports without column headings.

Example

 SET CLASS = 'R'
SET FORM = 'C012'
SET WIDTH = 70
SET LINES = 58
SET REPORTID = 'CICSM16'
SET TITLE = 'MAINVIEW for CICS - Monthly System Status'
SET TITLE1 = '        User Logon Times           '

   SELECT TYPE 6E RECORDS FROM CMRDETL
       WHERE  T6ETMID   NOT EQUAL '    '
           SET COUNT = COUNT + 1

   USING CMRDATE CMRTIME T6ETRID T6ERESP T6ECPUR T6ETMID T6EOPID
   REPORT
   PRINT COUNT
 END



 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*