IBM Version 4 Universal Remote User Manual


 
Coding for New Function
New function from IBM can cause programs to fail if the programs do not allow for
the handling of a new function.
The example programs in the following topics create a list of all objects that adopt
authority and then process the objects based on their object type. The new func-
tion added is the addition of another object type, *SRVPGM, that can adopt owner
authority.
A general theme of this example is never to assume that the values returned by an
API are static. OS/400 is continually evolving. While the example is based on the
addition of a new object type, this philosophy should be applied to any output of an
API. For example, if an API today can return *YES or *NO, you should discretely
check for these values because *MAYBE might be valid in the future. Similarly, if
your application assumes a particular integer output has a positive nonzero value
(an offset for instance), you should check for a positive nonzero value because
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 type. This is
shown at 2 on page 9-40. The example program considers only object types of
*SQLPKG or *PGMs. This is because they are the only object types that could
adopt owner authority before Version 2 Release 3. Since that time, a new object
type of *SRVPGM has been introduced. *SRVPGM can adopt owner authority.
Hence, this example program processes *SRVPGM objects as if they were *PGM
objects. The correct coding is shown at 23 on page 9-47.
Dᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍ
Dᑍ
DᑍProgram Name: PGM1
Dᑍ
DᑍProgram Language: ILE RPG
Dᑍ
DᑍDescription: This example program demonstrates how a program 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