IBM Version 4 manual Coding, Defining a Data Structure-Example

Models: Version 4

1 505
Download 505 pages 30.92 Kb
Page 213
Image 213

C

PARM

RECVR

 

C

PARM

QUSBN

 

\

 

 

 

\ DISPLAY THE JOB NAME

 

 

C

DSPLY

JNAME >>> When displayed,JNAME

\

 

will look something like

\

 

'QCPF

QS'

\ DELETE THE SPACE THAT HELD THE DATA

 

C

CALL 'QUSDLTUS'

 

 

C

PARM

SPCNAM

 

C

PARM

QUSBN

 

\\

 

 

 

C

SETON

LR

 

Defining A Data Structure—Example

of Correct

Coding

The following

program uses

a data structure that is supplied from th

library. When you use this data structure, you can prevent errors creation from happening. If the data structures change from release

updates

to

programs

do not have to be done.

The

application

program

to

be

updated ifonlya

new field was added to

the

data structure a

 

 

 

 

 

 

 

 

to

use

the field. The copying of the QSYSINC

data

.structure6/ on

is sho

page 9-7.

 

 

 

 

 

 

 

\

 

 

 

 

 

 

 

 

 

\

 

 

 

 

 

 

 

 

 

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

 

 

 

\

 

 

 

 

 

 

 

 

 

\Program Name: PGM2

 

 

 

 

 

 

\

 

 

 

 

 

 

 

 

 

\Program Language: RPG

 

 

 

 

 

 

\

 

 

 

 

 

 

 

 

 

\Description: This sample program illustrates the correc￿t

 

 

 

 

 

\

 

 

way of defining data structures.

 

 

 

 

 

\

 

 

 

 

 

 

 

 

 

\Header Files Included: QUSEC - Error Code Parameter

 

 

 

 

 

\

 

 

 

QUSGEN - User Space Format for Generic Header

 

\

 

 

 

QUSLJOB - List Job API

 

 

 

 

 

\

 

 

 

 

 

 

 

 

 

\APIs Used:

QUSCRTUS - Create User Space

 

 

 

 

 

\QUSLJOB - List Job

\QUSRTVUS - Retrieve User Space

\QUSDLTUS - Delete User Space

\THIS PROGRAM WILL CREATE THE NECESSARY SPACE AND THEN CA￿LL

\THE QUSLJOB API TO GET A LIST OF ALL ACTIVE JOBS ON THE SYS￿TEM.

\THE FIRST JOB NAME/USER WILL BE DISPLAYED TO THE USER.

\

 

 

 

 

I/COPY QSYSINC/QRPGSRC,QUSGEN

 

 

I/COPY QSYSINC/QRPGSRC,QUSEC

 

 

I/COPY QSYSINC/QRPGSRC,QUSLJOB

 

.6/

\\ JOB NAME STRUCTURE FOR CALLING QUSLJOB

 

IJOBNAM

DS

 

 

 

I I

'\ALL

'

1

1ð JOB

I I

'\ALL

'

11

2ð USER

I I

'\ALL'

 

21

26 JOBNUM

\\ JOBLð1ðð FORMAT RETURNED FROM QUSLJOB API

Chapter 9. Common API Programming Errors 9-7

Page 213
Image 213
IBM Version 4 manual Coding, Defining a Data Structure-Example