The RtvUsrSpace procedure retrieves data from a *USRSPC (user space) object. Unlike the GetUsrSpace procedure, RtvUsrSpace retrieves the user space data and stores it in a parameter variable.
The RtvUsrSpace procedure can be used to retrieve data from an existing user space object. A the substring parameters allow the entire user space to be retrieved or a portion. The retrieve user space procedure may only retrieve or delete/remove text from an existing character field. The original data is not modified by the procedure but is returned to the caller as the return value for the procedure call.
nBytes-returned RtvUsrSpace( szUserSpace 21A Const nStart 10I 0 Const nLength 10I 0 Const szRtnData 32766A Options(*VARSIZE) ) |
|
See also: CrtUsrSpace, GetUsrSpace |
*...v....1....v....2
'MYSPACE QTEMP '
An alternative syntax is also supported for the user space parameter. The alternate syntax allows you to specify the user space name similar to that of an OS/400 CL command, that is it may be qualified using qualified name syntax, as follows:
*...v....1....v....2
'QTEMP/MYSPACE '
The qualified user space name is MYSPACE in the QTEMP library. Either syntax is acceptable.
The number of bytes retrieved from the user space.
If the function fails, check the XT_ERROR data structure's subfield XT_ERRMSGID for the error message ID indicating why the user space was not created.
Normally, the command and user space name are the only values that need to be specified. For example:
.....DName+++++++++++EUDS.......Length+TDc.Functions++++++++++++++++++++++++++
D szUS C Const('CONTROLS QGPL')
D szNextCust S 7A
D nNextCust S 7P 0
.....CSRn01..............OpCode(ex)Extended-factor2++++++++++++++++++++++++++++++
C callP RtvUsrSpace(szUS:1:7:szNextCust)
C eval nNextCust = CharToNum(szNextCust) + 1
C callp ChgUsrSpace(szUS:1:7 : %EditC(nNextCust:'X'))
The call to RtvUsrSpace() retrieves the first 7 bytes of the user space named CONTROLS in the QGPL library. The second line of code converts that value to numeric and assigns it to the numeric field named nNextCust. Then the user space is updated with the new value.