CENDIF

C\

C\ Delete the user space called APIUG1 in library QGPL.

C\

 

 

 

C

 

CALL 'QUSDLTUS'

C

 

PARM

USERSP

C

 

PARM

QUSBN

C\ See if any errors were returned in the error code parame￿ter.

C

 

EXSR ERRCOD

C\

 

 

 

C

 

SETON

LR

C

 

RETRN

 

C\

 

 

 

C\ End of MAINLINE

 

 

C\

 

 

 

C\ Subroutine to handle errors returned in the error code

C\ parameter.

 

 

C\

 

 

 

C

ERRCOD

BEGSR

 

C

QUSBNC

IFGT ð

 

C\

 

 

 

C\ Process errors returned from the API.

C\

 

 

 

C

 

END

 

C

 

ENDSR

 

Using Offsets in a

User Space—Example of

Correct Coding

The following example program has code in it that compensates for the convention of that starts at 0. The code adds 1 to the starting po offset. This is shown.19/ aton page 9-34.

I\

 

 

I\Program Name: APIUG2

 

I\

 

 

I\Programming Language:

RPG

I\

 

 

I\Description: This sample program illustrates the corre￿ct

I\

way of using offsets in user space.

I\

 

 

I\Header Files Included: QUSGEN - Generic Header of a User S￿pace

I\

 

QUSEC - Error Code Parameter

I\

 

(Copied into Program)

I\

 

QUSLOBJ - List Objects API

I\

 

 

I\APIs Used:

QUSCRTUS -

Create User Space

I\

QUSLOBJ -

List Objects

I\

QUSRTVUS -

Retrieve User Space

I\

QUSDLTUS -

Delete User Space

I\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

I\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

I\

I\ Generic Header of a User Space Include

I\

I/COPY QSYSINC/QRPGSRC,QUSGEN

I\

I\ Error Code Parameter Include for the APIs

I\

Chapter 9. Common API Programming Errors 9-31

Page 237
Image 237
IBM Version 4 manual Using Offsets in a, Correct Coding, User Space-Example