Manipulating a User Space without Pointers
Changing a User Space with an OPM RPG Program—Example
To change the user area of a user space with a call from an OPM RPG program,
specify the following:
Hᑍ ᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍ
Hᑍ ᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍ
Hᑍ ᑍ
Hᑍ PROGRAM: CHANGUS ᑍ
Hᑍ ᑍ
Hᑍ LANGUAGE: RPG ᑍ
Hᑍ ᑍ
Hᑍ DESCRIPTION: THIS PROGRAM WILL CHANGE THE CONTENTS OF ᑍ
Hᑍ INFORMATION IN THE USER AREA IN THE USER SPACE ᑍ
Hᑍ (FIRST 64 BYTES). ᑍ
Hᑍ ᑍ
Hᑍ APIs USED: QUSCHGUS ᑍ
Hᑍ ᑍ
Hᑍ ᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍ
Hᑍ ᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍ
E ARY 1 1 2
E CHG 1 1 64
IUSRSPC DS
I 1 1 USNAME
I 11 2 USLIB
I DS
I B 1 4LENDTA
I B 5 8STRPOS
Cᑍ ᑍ
Cᑍ ᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍ
Cᑍ ᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍ
Cᑍ ᑍ
Cᑍ OPERABLE CODE STARTS HERE ᑍ
Cᑍ ᑍ
Cᑍ ᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍ
Cᑍ ᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍ
Cᑍ ᑍ
Cᑍ MOVE THE USER SPACE AND LIBRARY NAME FROM ARY ARRAY INTO THE ᑍ
Cᑍ USRSPC DATA STRUCTURE. ALSO, MOVE THE NEW USER DATA FROM ᑍ
Cᑍ CHG ARRAY INTO NEWVAL. ᑍ
Cᑍ ᑍ
C MOVELARY,1 USRSPC
C MOVELCHG,1 NEWVAL 64
Cᑍ ᑍ
C Z-ADD64 LENDTA LEN OF USERAREA
C Z-ADD1 STRPOS STARTING POS
C MOVE '1' FORCE 1 FORCE PARM
Cᑍ ᑍ
Cᑍ CALL THE QUSCHGUS API WHICH WILL CHANGE THE USER AREA IN THE ᑍ
Cᑍ USER SPACE. ᑍ
Cᑍ ᑍ
C CALL 'QUSCHGUS'
C PARM USRSPC
C PARM STRPOS
C PARM LENDTA
C PARM NEWVAL
C PARM FORCE
Cᑍ ᑍ
Cᑍ IF MORE OF THE USER SPACE NEEDS TO BE CHANGED, THIS PROGRAM ᑍ
Cᑍ COULD BE UPDATED TO LOOP UNTIL THE END OF THE ARRAY WAS ᑍ
Cᑍ REACHED. ᑍ
Cᑍ ᑍ
C SETON LR
C RETRN
ᑍᑍ ARY
TEMPSPACE QGPL
ᑍᑍ CHG
Big String padded with blanks
Chapter 2. Getting Started with APIs
2-21