Manipulating a User Space without Pointers
Changing a User Space with an ILE RPG Program—Example
To change the user area of a user space as shown in the previous example with a
call from an ILE RPG program, specify the following:
Hᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍ
Hᑍ
Hᑍ PROGRAM: CHANGUSPTR
Hᑍ
Hᑍ LANGUAGE: ILE RPG for OS/4
Hᑍ
Hᑍ DESCRIPTION: CHANGE THE CONTENTS OF INFORMATION IN THE USER
Hᑍ AREA IN THE USER SPACE USING A POINTER
Hᑍ
Hᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍ
Dᑍ
DUSRSPCNAM S 2 INZ('TEMPSPACE QTEMP ')
DNEWVALUE S 64 INZ('Big String padded with blanks')
DUSRSPCPTR S ᑍ
DUSERAREA DS BASED(USRSPCPTR)
D CHARFIELD 1 64
Dᑍ
Dᑍ Following QUSEC structure copied from QSYSINC library
Dᑍ
DQUSEC DS
Dᑍ Qus EC
D QUSBPRV 1 4B
Dᑍ Bytes Provided
D QUSBAVL 5 8B
Dᑍ Bytes Available
D QUSEI 9 15
Dᑍ Exception Id
D QUSERVED 16 16
Dᑍ Reserved
Dᑍ End of QSYSINC copy
Dᑍ
Cᑍ
Cᑍ Initialize Error code structure to return error ids
Cᑍ
C Z-ADD 16 QUSBPRV
Cᑍ
Cᑍ Set USRSPCPTR to the address of the User Space
Cᑍ
C CALL 'QUSPTRUS'
C PARM USRSPCNAM
C PARM USRSPCPTR
C PARM QUSEC
Cᑍ
Cᑍ Check for successful setting of pointer
Cᑍ
C QUSBAVL IFGT
Cᑍ
Cᑍ If an error, then display the error message id
Cᑍ
C DSPLY QUSEI
C ELSE
Cᑍ
Cᑍ Otherwise, update the User Space via the based structure
Cᑍ
C MOVEL NEWVALUE USERAREA
C END
Cᑍ
Cᑍ And return to our caller
Cᑍ
C SETON LR
C RETURN
2-20 System API Programming V4R1