Coding for New Function

New

function

from

IBM

can cause programs to fail if the programs do n

the

handling

of a

new

function.

The example programs in the following topics create a list of all obje authority and then process the objects based on their object type. tion added is the addition of another object type, *SRVPGM, that can authority.

 

 

 

A general

theme

of

this

example is

never

to

assume that

the

values

r

 

 

 

API are static. OS/400 is continually evolving. While the example

 

is

base

 

 

 

addition

of

a

new

object type,

this

philosophy should be

applied

to

 

 

 

API. For example, if an API

today

can

return

*YES

or

*NO,

you

should

 

di

 

 

 

check

for these values because *MAYBE might be valid in the future. Si

 

 

 

your

application

assumes a particular integer output has a positive nonz

 

 

 

(an

offset

for

instance), you should check for a

positive

nonzero

valu

 

 

 

future releases

could return a negative value to indicate

new

function

Coding

for

New

Function—Example

of

Incorrect

 

Coding

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

In

this

example

program,

a

check is made to determine the

object

 

ty

 

 

 

shown

at.2ð/ on page

9-40. The

example

program considers

only

object

type

 

 

 

*SQLPKG

or *PGMs. This is because they are

the

only

object

 

types

that

 

 

 

adopt

owner

authority

before Version

2

Release

3.

Since

 

that

time,

a

 

 

 

type

of

*SRVPGM

has been introduced. *SRVPGM can adopt owner authority.

 

 

 

Hence, this example program processes *SRVPGM objects as if they were

 

 

 

objects. The

correct

coding

is.23/ shownon paget

9-47.

 

 

 

 

 

 

 

 

 

 

 

 

D\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

 

 

 

 

 

 

 

 

 

 

 

D\

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

D\Program Name: PGM1

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

D\

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

D\Program Language:

ILE RPG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

D\

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

D\Description: This example program demonstrates how a pr￿ogram can

 

 

 

 

 

 

 

 

 

 

 

D\

 

 

 

be "broken" by new functions introduced on the AS/4ðð.

 

 

 

 

 

 

 

 

 

 

D\

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

D\

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

D\

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

D\Header Files Included: QUSGEN -

Generic Header of a User Space

 

 

 

 

 

 

 

 

 

 

 

D\

 

 

 

 

 

 

 

 

(Copied Into Program)

 

 

 

 

 

 

 

 

 

 

 

 

 

D\

 

 

 

 

 

QUSEC -

Error Code Parameter

 

 

 

 

 

 

 

 

 

 

 

 

 

D\

 

 

 

 

 

 

 

 

(Copied Into Program)

 

 

 

 

 

 

 

 

 

 

 

 

 

D\

 

 

 

 

 

QSYLOBJP - List Objects API

 

 

 

 

 

 

 

 

 

 

 

 

 

 

D\

 

 

 

 

 

 

 

 

(Copied Into Program)

 

 

 

 

 

 

 

 

 

 

 

 

 

D\

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

D\APIs Used: QUSCRTUS - Create User Space

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

D\

 

 

QSYLOBJP - List Objects That Adopt Owner Authority

 

 

 

 

 

 

 

 

 

 

 

D\

 

 

QUSROBJD - Retrieve Object Description

 

 

 

 

 

 

 

 

 

 

 

 

 

 

D\

 

 

QUSPTRUS - Retrieve Pointer to User Space

 

 

 

 

 

 

 

 

 

 

 

 

 

D\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

 

 

 

 

 

 

 

 

 

 

 

D\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

 

 

 

 

 

 

 

 

 

 

 

D\

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

D\ This program demonstrates how a program can be "broken"￿ by

 

 

 

 

 

 

 

 

 

 

 

 

C\ new functions introduced on the AS/4ðð.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

D\

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

9-36

System

API

Programming

V4R1

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Page 242
Image 242
IBM Version 4 manual Coding for New Function, For