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 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 U￿SER

 

H\

 

AREA IN THE USER SPACE USING A POINTER

 

H\

 

 

 

 

 

H\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

D\

 

 

 

 

 

DUSRSPCNAM

S

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-20System API Programming V4R1

Page 40
Image 40
IBM Version 4 manual Changing a User Space with an ILE RPG Program-Example, Program Changusptr