Updating Information In A Data Set - IBM TSO/E REXX User Manual

Table of Contents

Advertisement

Using EXECIO to Process Information ...

Updating Information in a Data Set

You can update a single line of a data set with the EXECIO command, or you can
update multiple lines. Use the DISKRU form of the EXECIO command to read
information that you may subsequently update.
Note: The line written must be the same length as the line read. When a changed
Updating a single line: When updating a single line in a data set, it is more
efficient to locate the line in advance and specify the update to it rather than read
all the lines in the data set to the stack, locate and change the line, and then write
all the lines back.
For example, you have a data set named 'DEPT5.EMPLOYEE.LIST' that contains a
list of employee names, user IDs, and phone extensions.
Adams, Joe
Crandall, Amy
Devon, David
Garrison, Donna
Leone, Mary
Sebastian, Isaac
To change a phone extension to 5500 on a particular line, such as Amy Crandall's,
specify the line number, in this case, 2, and write the following instructions. Notice
the "OLD" attribute on the allocation. The "OLD" attribute guarantees that no one
else can use the data set while you are updating it.
Updating multiple lines: To update multiple lines, you can issue more than one
EXECIO command to the same data set. For example, to update Mary Leone's
user ID in addition to Amy Crandall's phone extension, write the following
instructions.
162
z/OS V1R1.0 TSO/E REXX User's Guide
Copying from Compound Variables
"ALLOC DA(new.data) F(outdd) LIKE(old.data) NEW"
"EXECIO 10 DISKW outdd (STEM NEWVAR."
line is longer than the original line, information that extends beyond the
original number of bytes is truncated and EXECIO sends a return code of 1.
If lines must be made longer, write the data to a new data set. When a
changed line is shorter than the original line, it is padded with blanks to
attain the original line length.
JADAMS
AMY
DAVIDD
DONNAG
LEONE1
ISAAC
Updating a Specific Line in a Data Set
"ALLOC DA('dept5.employee.list') F(updatedd) OLD"
"EXECIO 1 DISKRU updatedd 2 (LIFO"
PULL line
PUSH 'Crandall, Amy
"EXECIO 1 DISKW updatedd (FINIS"
"FREE F(updatedd)"
5532
5421
5512
5514
5530
5488
AMY
5500'

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents