PUT (QSAM)
Syntax:
PUT(ddname,recin)
Arguments:
-
ddname
-
is the 1 to 8 character name that identifies the data set
you want to process. This name needs to have been
previously associated with the data set, either via the
ALLOCATE command or JCL DD statement, and opened via the
OPEN
function.
-
recin
-
contains the record to be written or updated. For varying
length record formats, the interface will record the
actual record length up to the maximum LRECL. Records that
exceed the maximum length are truncated on the right.
For fixed length record formats, the record will be padded
with blanks or truncated on the right to make it fit the
fixed record size.
When updating records -- both varying length and fixed
length -- the interface will force the replacement record
to the exact size of the original record, padding or
truncating as necessary.
Module Name:
SWXPUT
Service Description:
The PUT function is used to write or update records of sequential
data sets (permanent and temporary), SYSOUT data sets, and PDS
members. Before you can call the PUT function you must first
allocate and open the data set associated with the ddname
argument. If you do not, an error will occur. When open for
output, PUT writes records sequentially (i.e., you cannot skip
record slots).
If you are using PUT to update a record, you must first retrieve
the record using the
GET
function. When updating a file, you do not need to update every
record.
Returned Information:
The PUT function returns the QSAM PUT macro return code. If you
CALL the PUT function, the returned value is contained in the
RESULT special variable.
After completion of a PUT function call, the RC and REASON
variables will contain return code information. You should treat
these variables as "read only" and make no attempt to modify any
of them. The variables are:
-
RC
-
Contains the QSAM PUT return code. An RC of zero means the
operation was completed successfully.
-
REASON
-
Contains the QSAM PUT reason code.
Examples:
-
Sequentially retrieve and update all of a data set's records:
record = get('iodd')
do while rc = 0
parse var record firstpart 10 salary 15 lastpart
newsal = p2d(salary,2) * 1.1
newrec = firstpart || d2p(newsal,5) || lastpart
call put 'iodd', newrec
if rc = 0 then record = get('iodd')
end
-
Add records to the end of a sequential data set.:
"alloc fi(moddd) da(user.data) mod"
call open 'qsam', 'moddd', 'output'
say 'Enter a new record:'; parse pull record
do while record <> ''
call put 'moddd', record
say 'Enter a new record:'; parse pull record
end
© Copyright 1998 by Open Software Technologies, Inc.