The CrtUsrSpace procedure creates a *USRSPC (user space) object on the system.
The CrtUsrSpace procedure can be used to create a user space object on the system. The size, auto-extend attribute, and domain may be specified.
void CrtUsrSpace( szUserSpace 21A Const szExtAttr 10A Const OPTIONS(*NOPASS : *OMIT) nSize 10I 0 Const OPTIONS(*NOPASS : *OMIT) bAutoExt 1N Const OPTIONS(*NOPASS : *OMIT) bReplace 1N Const OPTIONS(*NOPASS : *OMIT) szTextDesc 50A Const OPTIONS(*NOPASS : *OMIT) nDomain 10I 0 Const OPTIONS(*NOPASS : *OMIT) ) |
|
See also: ChgUsrSpace, DltUsrSpace |
*...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.
| Named Constant | Value | Description |
| XT_CS_DFTDOM | 0 | The user space is created in the default domain based on the system setup. Typically this means it is created in the user domain. |
| XT_CS_USRDOM | 1 | The user space is created in the user domain. |
| XT_CS_SYSDOM | 2 | The user space is created in the system domain. |
If this parameter is not specified, the default is XT_CS_DFTDOM
If the user space is created, *ON is returned, otherwise, *OFF is returned.
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('MYUSRSPC QGPL')
D szMyUs C Const('FIELDLIST QTEMP')
.....CSRn01..............OpCode(ex)Extended-factor2+++++++++++++++++++++++++++
C CallP CrtUsrSpace(szUS)
C CallP CrtUsrSpace(szMyUS : *OMIT : XT_MAXUSRSPC)
C CallP CrtUsrSpace('QTEMP/MYSPACE')
The first call to CrtUsrSpace() creates a user space named MYUSRSPC in the QGPL library, using the defaults for size, extendibility and so on.
The second call to CrtUsrSpace() creates a user space named FIELDLIST in the QTEMP library and sizes it to the maximum allowed for a user space (currently 16 megabytes in length).
The third call to CrtUsrSpace() creates a user space named MYSPACE in the QTEMP library. Note the syntax for the user space name used in this example is in the traditional OS/400 CL command style of library/object. Both formats are supported.