Page 1 of 1

what is the point of WRITE KEYTO?

Posted: Thu Jun 08, 2017 9:42 pm
by peeterjoot
I understand the point of the KEYFROM option in WRITE. For example I could do a VSAM write using:

WRITE FILE(myfile) KEYFROM(mykey) FROM(myrecord)

The Enterprise PL/I for z/OS Language Reference manual also specifies that a KEYTO() option is allowed for WRITE. What would that be used for?

Re: what is the point of WRITE KEYTO?

Posted: Thu Jun 08, 2017 9:48 pm
by Akatsukami
The Language Reference does not state that KEYTO can be used with WRITE, but rather with READ; see page 299.

Re: what is the point of WRITE KEYTO?

Posted: Thu Jun 08, 2017 9:52 pm
by Robert Sample
From the version 5.1 Programming Guide page 295:
You can obtain the RBA for a record by using the KEYTO option, either on a WRITE statement when you are loading or extending the data set, or on a READ statement when the data set is being read. You can subsequently use an RBA obtained in either of these ways in the KEY option of a READ or REWRITE statement.

Re: what is the point of WRITE KEYTO?

Posted: Thu Jun 08, 2017 9:53 pm
by peeterjoot
Akatsukami wrote: The Language Reference does not state that KEYTO can be used with WRITE, but rather with READ; see page 299.
On page 313, the syntax diagram shows:

►► WRITE FILE (file-reference) FROM (reference) ►

KEYFROM(expression)
KEYTO(reference)