IBM Systems Magazine

Coding Challenge Coding Live

To bring these code snippets together into a functional program, you need a little bit of glue around them. Ive added a simple loop that demonstrates processing each record from the stem variable in sequence:

To learn more about this topic, read these articles:

The first command uses the syntax of the TSO ALLOCATE command. Under TSO, try the command HELP ALLOCATE SYNTAX for a quick overview of the command parameters.

2018MSP Communications, Inc. All rights reserved

Michael Cairns works for IBM as a technical specialist in the Tivoli zSecure range of software. Michael can be reached at .

REXX Offers Tools for Automated Processing of SMF Data

Reading and Writing Files in the REXX programming language on z/OS.

TIPS & TECHNIQUES>

Leveraging SMF Data With (or Without) REXX

execio * diskr input (stem input. finis)

Reading z/OS data sets in REXX requires two steps. First, allocate the data setthis is a Time Sharing Option (TSO) command. Second, process the records in the data setthis is implemented as a TSO REXX command. The commands are, in sequence:

APPLICATION DEVELOPMENT

MAINFRAME>

In this series of articles, Ill provide a beginners guide to the REXX* programming language on z/OS*. Lets head straight into reading and writing files.

APPLICATION DEVELOPMENT

REXX Programmers Shouldnt Overlook Stacks

MAINFRAME>

REXX Routines for Easy Updates or Generating Workload

Since you read the entire file into a buffer, you now need some way of processing each record in sequence from the stem variable. To do this, take advantage of the fact that reading the file in this manner has automatically updated a special stem variable with the number of records read. This is the stem zero variable and is addressed as stem.0 in REXX. The value of the input.0 variable is used in this case to determine the upper limit for a do while loop to process all records in the stem variable. Records in the stem variable are addressed by record number using the syntax stem.record_num, or unt in the code below.

IBM Systems Magazine is a trademark of International Business Machines Corporation. The editorial content of IBM Systems Magazine is placed on this website by MSP TechMedia under license from International Business Machines Corporation.

A Closer Look at the REXX Code for Processing SMF Data

We use cookies to optimize your visit to our website. By visiting our website without changing your settings, youre acknowledging your consent to receive cookies on our website. If you would like to change your cookie settings at any time please view ourprivacy policyfor additional information.Agree

The second command is a little trickier. See Code Sample 1 for a quick description of the full command syntax Ive used here. For any REXX-platform-specific implementation, theres a dedicated I/O processing capability. Under TSO, this is implemented with the execio command. There are many variations on this command, some more of which Ill explore in future articles. In this case, youve read the entire file into a buffer in one pass. The buffer is technically referred to as a stem variable, and Ill use this term from now on. The stem variable specified in the above execio statement is named input. The trailing dot character, while not essential, is highly recommended. Process the contents of the stem variable separately. Close the file automatically after reading it so, if desired, you can now issue the TSO FREE command like this:

TIPS & TECHNIQUES>

Leave a Reply