Manipulating a User Space without Pointers

Manipulating a User Space without Pointers

When programming in a language that does not support pointers, you can Change User Space (QUSCHGUS) and Retrieve User Space (QUSRTVUS) API to manipulate data. However, you must first understand how to use po lengths with these APIs.

Position Values

Some APIs return offset values into a user space. To use other APIs Retrieve User Space (QUSRTVUS) API, you must use position values to bytes.

Position values

and

offset

values

are

different

ways to

express

the

offset

value

is

the

relative

distance

of

a byte

from

the

first

byte

which

has

an

offset valuepositionof value0.

A

is

the offset

value

plus 1.

For examples of HLL programs that use positions, see “List Object API Example” on page 5-4.

Lengths

List APIs return the length of the information in the different sect space, as well as the length of the list entries in the user spac your application using the lengths returned instead of specifying the

returned by the API or the

size of a data structure

in

the dat

amount

of

information

returned

for

any format

may increase

in

future

the information will be placed

at the end of the existing

informatio

your application to function properly, it should retrieve the

length o

returned and add that length

to

a pointer or to a starting

position

Using

Offset

Values with

the Change

and

Retrieve User

Space

 

 

APIs

 

 

 

 

 

 

 

 

When you use the Change User Space (QUSCHGUS) or Retrieve User Sp (QUSRTVUS) API, your application program should first retrieve the of the information you want. You must then add one to the offset value starting position for the information.

Changing a User Space—Example

Before and after illustrations show how the QUSCHGUS API changes a space. The following is a user space before you change it with one examples.

Chapter 2. Getting Started with2-17APIs

Page 37
Image 37
IBM Version 4 manual Manipulating a User Space without Pointers, Position Values, Lengths, Space APIs