PUT(ddname,recin)
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.
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.
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:
"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
"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'