TSO-ISPF JCL COBOL VSAM DB2 CICS Tools Articles Job Portal Forum Quiz Interview Q&A

Rexx Control Records


Control records drive the file-tailoring process and will be treated as key words in the skeleton.

Following are the characteristics of control records.

  • All Control records begin with right parentheses )

  • Control records cannot be continued.

  • Right parenthesis must start in column1 with the control statement immediately following.

  • All control words must be in upper case.

  • Variables will be substituted prior to the evaluation of control statement.


There are various types of control statements used to control the file tailoring process. A few control statements are given below for reference:

IMBED:

IM statement functions similar to a copy book in COBOL. Reusable skeleton contents can be stored in a separate member and can be embedded in another skeleton. Imbedded skeleton contents will be expanded during the time of execution.

)IM skel-name [NT] [OPT]

  • skel-name - Member to be imbedded.

  • NT - When specified no tailoring to be performed.

  • OPT - If not found, no severe error.


BLANK:

As mentioned earlier, blank lines will be skipped from the skeleton during file-tailoring process. In order to inject blank lines in the desired places, BLANK control statement can be used. Number of blank lines to be introduced can be specified as a parameter.

)BLANK Number where

  • Number - Number of blank lines to be injected.

For example, )BLANK 3 introduces three blank lines in the place where it is specified.


SET:

SET statements can be used to assign value to a variable directly or after executing an arithmetic / string manipulating expression.

)SET variable = expression

Expression – value

- value1 operator1 value2 operator2 value3

Example:
)SET V1 = 1

The earlier statement assigns a value of 1 to the variable V1.

)SET	V2 = &V1 + 3

The earlier statement calculates and assigns the calculated value to the variable V2. As V1 holds a value of 1, V2 will be assigned with a value of 4.


COMMENT:

CM statements can be used to add comments in a skeleton so that the flow can be easily followed.

)CM comment

TABBING:

TB statements are used to introduce tabs in the data records marked by special character '!'.

)TB value1 value2 … value5
      value1, value2	are tab / data positions

Positions:

  • Data position denotes the position where data should begin.

  • Tab position denotes the position where tab should begin.

  • A value specified in )TB command will be called as a tab position, if the value marks a position immediately after the end of data. Otherwise, it will be treated as a data position.

  • Any position that follows a tab position is a data position

Things to be taken care of:

  • Positions specified should be in ascending order.

  • A position should start after allowing enough space for preceding data.

Example 1:
)TB 6 9
                      56789!0123

Here number of characters before '!' is 5 and the immediate next position i.e. 6 will be referred to as tab position.

In the above example, 6 is tab position and 9 is data position. After file-tailoring, above example will result in 56789…0123.

Example 2:
)TB 6 9 15
                      56789!012!32

In the above example, 6 is a tab position where as 9 and 15 are data positions. Here 15 is not a tab position as it doesn‘t equal the immediate next position (after first tabbing is applied).

Once tabbing is applied to the first tab character '!' the result will be 56789…012 (the length of which is 11). Since position 15 doesn't equal the immediate next position (i.e. 12) of the string 56789…012, it is treated as a data position. The next string '32' will start at position 15 as follows:

56789…012…32.

Example 3:
)TB 4 10
                      56789!0123

Here number of characters before '!' is 5 and the position value '4' specified in )TB section is less than the length of data. Since the data position doesn't allow enough space for the preceding data this results in output overflow error.


Tabbing samples:

TAB StatementData positionsTab positionsResult
)TB 6 9 15 17 20
56879!012!32!56
9, 15, 20 6, 17 56879...012...32...56
)TB 9 15 20
56879!012!32!56
9, 15, 20 Nil 56879...012...32...56
)TB 9 11 20
56879!012!32!56
- - Output over flow Error. Position '11' doesn't allow enough space for preceding data

ALTERNATE TABBING:

Alternate tabbing is similar to tabbing except for the fact that, data positions alone are considered for alternate tabbing. When alternate tabbing is specified, tab characters ‗!‘ corresponding to tab positions are not considered for tabbing.

Alternate tabbing can be global or position specific.

Global:

)TBA is used for global alternate tabbing.

Example:

)TBA 6 12 14 18
56879!012!32!56

In the earlier example, 6 is a tab position and hence the first tab character '!' will not be considered for tabbing. Thus, '56879012' will be considered as a continuous string. The next immediate position of this string is 9. Since this is not equal to the value '12' in) TB statement, value '12' is treated as a data position. Thus tabbing will be applied for the next tab character '!', which causes string '32' to start at 12th position.

Considering the length of string '32', value '14' is a tab position and hence tabbing will not be applied for the next tab character '!' which results in a continuous string of '3256'.

Thus the final result would be 56879012...3256.

Position Specific:

A is added to the value to which alternate tabbing needs to be applied.

)TB 6A 12 14 18
56879!012!32!56

Here position 6 alone will be considered for alternate tabbing and the result would be,

56879012...32....56.

DOT:

DOT statements are used to perform iterative tasks. )DOT statement is followed by an ISPF table name. All skeleton records enclosed between )DOT and )ENDDOT statements are iteratively processed for each row in the table.

  )DOT Table
        Expressions
  )ENDDOT

Table – denotes the name of the ISPF table. This must be specified in upper case.

Example:
)TB 5 25
                      )DOT SAMPLE
                  !&V1 !&V2
                      )ENDDOT

For each and every row in ISPF TABLE 'SAMPLE', tabbing is applied on the variables V1 and V2.


SELECT:

SEL statements are used to select a portion of skeleton to be tailored and written into output when the expression specified in the SEL statement is TRUE.

)SEL relational expression
        Data records
              )ENDSEL

Here the relational expression will be evaluated. If TRUE, all statements between )SEL and )ENDSEL will be processed. Otherwise, the statements are skipped.

Allowable operators to be used in the relational expression are:

OperationOperator
Equal to EQ or =
Not equal to NE or ^=
Greater Than GT or >
Lesser Than LT or <
Less than or equal to LE or <=
Greater than or equal to GE or >=
Not Greater than NG or ^>
Not Less than NL or ^<

Note:

Caution should be exercised while using tabs on table variables. A higher length for a variable value could cause output buffer overflow.


If you have any doubts or queries related to this chapter, get them clarified from our Mainframe experts on ibmmainframer Community!

Are you looking for Job Change? Job Portal