PUT (BPAM)

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 PDS/PDSE members. Before you can call the PUT function you must first allocate and open the data set associated with the ddname argument. If you are creating a new member, the last PUT must be followed by a STOWM function to create the directory entry.

If you are using PUT to update a record, you must first retrieve the record using the GET function. All other PUT requests are treated as write requests.

You may use PUT only if the file has been opened for output or update. If the file is open for input, you must close and re-open it for output or update.

Returned Information:

The PUT function returns the BPAM 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 BPAM PUT return code. An RC of zero means the operation was completed successfully.
REASON
Contains the BPAM PUT reason code.

Examples:

  1. Sequentially retrieve and update all of a member's records:
    "alloc fi(iodd) da(mypds.data) old"
    call open 'bpam', 'iodd', 'update'
    call findm 'iodd', 'payroll'
    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
    
  2. Create a new member:
    "alloc fi(outdd) da(mypds.data) old"
    call open 'bpam', 'outdd', 'output'
    say 'Enter a new record:'; parse pull record
    do while record <> ''
      call put 'outdd', record
      say 'Enter a new record:'; parse pull record
    end
    call stowm 'outdd', 'mem01'
    call close 'outdd'
    

© Copyright 1998 by Open Software Technologies, Inc.