IBM
Page
IBM
1997
First
Contents
Across
Chapter
Hold
RPG
APIs
Programming
MICRTPG2
Cobol
OPM
Index
Vii
OPM API
Viii System API Programming V4R1
Micrtpg
System API Programming V4R1
Disclaimed
IBM
Implied Warranties of Merchantability and Fitness for
Trademarks
Programming Interface Information
HLL
Use
Xiii
Prerequisite
Xiv System API Programming V4R1
Exit programs That are documented Systemin
API Compatibility
API Compatibility
You Not Have To go Through
Using APIs-Benefits
Saved Overhead Processing When You Call
Because
Cobol ILE RPG
System APIs or CL Commands-When Use
APIs
Functions
OS/400 APIs Are documented Following books
Related Information
Environments
Besides the OS/400 APIs that are
Unix
Started
Locating the API to
Socket Network Functions This
Verb
Language Selection Considerations Data Types
Selecting the High-Level Language To Use
API Environments
APIs for the ILE Common
APIs for the Integrated Language Environment
Environment CEE
Related Information
Integrated Language Environment ILE CEE APIs
APIs for the Unix Environment
API Parameters
Langua
Parameter Passing
Value of the data object is placed directl
Parameter List
Parameter Classification
Error Code Parameter
Code
Receiving Error Conditions as Exceptions-Example
Error
With Exception Data-Example
From
Errors
Getting Started with2-11APIs
Security Uses
Internal Identifiers
Spooling
Used by
User Spaces
User Spaces
Space
Xxxx
User Space Format-Example
+NO
Logic Flow of Processing a List of Entries
Synchronizing between Two or More Jobs
Using Offset Values with Pointers
With
Manipulating a User
Space APIs
Manipulating a User Space without Pointers
Position Values
Lengths
Quschgus API
Following is a user space after you change it with one
\ Program Changusptr
Changing a User Space with an ILE RPG Program-Example
RPG
Changing a User Space with an OPM RPG Program-Example
Additional Information about
List
User
Listing
A receiver variable or the beginning of a
Receiver Variables
Bytes Returned Fields
Beginning
Qusljob API
Keyed Interface
Qlicobjd API
Using a Continuation Handle
User Space Alternative
Continuation Handle
More information
Domain Concepts
API
Exit Points
Security, Qalwusrdmn Set to System configured forsystemC2
Exit Programs
Library
APIs and the Qsysinc
Include File
Ccsid
Compile Program Specific
InSystthem API Reference, SC41-5801
APIs and the Qusrtool Library
User Index Considerations
User Index Considerations
System
Performance Considerations
Performance Considerations
32System API Programming V4R1
First Step Finding the correct API is to Identify Part That
Information
Original Program Model OPM API-Scenario
Job Held Queue
Authorities
Description of an API
Parameters
Locks
Format You Can See fromDecthedecimal Offset Column
Are Based Objects That
Performs Object For
Are described in Required Parameter Group
This Name
Because the field is a binary
Would Make Binary Value
Can Place Format Name Pass Literal
Optional Parameter Group
Error Messages
Format
Field Descriptions
Only Possible values For Hold Job Queue Field Are
Example
Hold Parameter
Perspective
APIs-Examples
Call Jobdapi Parmxyz \LIBL
Handling Error Conditions-OPM RPG Example
Call Jobdapi Parmqbatch Qgpl
Call Jobdapi Parmqbatch \LIBL
OPM RPG
Ipgmsts SDS Msgidd
ITOUSRQPGMR36 47 MSG3B
Parameter
Error
Error Code Structure Can Found
Format Error code structure Qusbn is
Common Information across APIs-Basic OPM 3-Example13
Qgpl
Call Jobdapi Qpgmr XYZ
XYZ
Library Does Not Exist. Use the following call statement
Level Date Pgmr Change Description
Value Placed
Code used to access the Hold attribute. T
Accessing the Hold Attribute-OPM
Diagnostic Message exists Job Log Can Received
Structure
Error-code data structure
Following data structures are used
Retrieve job description data structure
Information across APIs-Basic OPM 3-Example
Initial
\$Að= D2862ððð
Common Information across APIs-Basic OPM 3-Example21
Icmdstr
\ENTRY
Jobdapi
With List
Spooled
Ispcnam
Outq
Common Information across APIs-Basic OPM 3-Example27
Qusptrus
Qusrtvus
Parameters
API-Example
Processing
Job Description Information
JOBD0100 Format
CHAR8
End Severity
Bytes
Bytes Returned
Library
Reply
Job date
Job
MSG
YES
Offset
RQD
Data
Text Description
Common Information across APIs-Basic OPM 3-Example37
38System API Programming V4R1
ILE API
Across
Integrated Language Environment
Point
APIs-Concepts
Generic Header Files
Exit Program Attributes Parameter
Keyed Interface-Example
Variable-Length Structure-Example
Key Type Field
Exit Program Attribute Keys
Initialize Bytes provided Field Number Parameter
Error Handling
Error Handling through the Error Code Parameter
Ccsid
Exception handling is by having All Exceptions Signa
Second
Entry
Receiver Variables-Examples
Fields-Example
With
ILE C
Registration Facility Using ILE APIs-Examples
Add Exit Program-ILE
\EXCLUDE
Description
Exit Point Example
API
12System API Programming V4R1
Language ILE C
EXAMPLEPGMEXAMPLELIB, Example Exit Program Data
Program
Output None
Rslvsppgmhdlr Function
Input
Information retrieved
16System API Programming V4R1
Common Information across APIs-Advanced ILE4-17Example
18System API Programming V4R1
Language ILE C Description
Remove Exit Program and Deregister Exit Point-ILE C Example
20System API Programming V4R1
Errorcode.ecfields.ExceptionId Exit1 \ End program \
22System API Programming V4R1
General Data Structure
Characteristics of a List
General Data Structure
Offset to List Data Section
Can Locate Remaining Information Place
Other Fields of Generic Header
On page 5-14 and the OBJP0200 Format on 5-14. This
Qsylobjp API
See Add Size Each Entry Field Get .7/ starton
Processing a List
List Object API-OPM RPG Example
Iqusbn
\/COPY QSYSINC/QRPGSRC,QUSEC
\FLAG Reason Level Date Pgmr Change Description
Quskyf
Qusbnf
Qusbng
Iqusky
Call Qsylobjp
\ENTRY Plist Parm
Exsr Init Exsr Proces Exsr Done
Begsr
Qusbnc
Parm Rjobdf
Parm Spcnam
Parm Spctyp
QSYB6
ADD Qusbpq Strpos
PROC2
Sizent
Movelqusrtvusapinam Exsr Apierr Endif
Nument Exsr PROC2
Qusbpj Ifeq
ADD Qusbpl Strpos
Oreq Exsr PROC1
Endif USRSPC=P/C Endsr
Begsr Movelqusbpj Lststs
Doueqc
Required Parameter Group
Authorities and Locks
Object type
OBJP0100
OBJP0200
User name
Section
User Space Variables
User
Field Descriptions
Attribute
Input
User space &4 in &9 damaged
Service Program Library &2 ended. Reason cod
Continuation handle not valid for
Object Type Not Valid
OPM
Error Conditions
Parameters
Without Pointers-ILE
This Program Calls Log Software Error Qpdloger
Pointers
Ffdc
Output None Exceptions
Ffdc Input
Unexpectedhdlr Function
\HANDLE
6System API Programming V4R1
QCLE/H
Software Error ILE
API with Pointers-ILE C Example
\ Unexpectedhdlr \
Function
SymptommsgkeywordMSGSYMPTOMLEN
\HANDLE
Numberofkeys, &ErrorCode
12System API Programming V4R1
Machine
Interface
Interface Instructions-Introduction
Section Discussing
Setting the Entry Point
Setting the Declare Statements
Writing an MI Program-Example
Result
ITS2
ARG2
Cpynv
MI01 Program-Complete Code Example
Compiling a Program
Rexx
Using Clcrtpg to Create
Creating the MI Example Program
Testing MI01
RST
Program
Debugging the MI Program
SAV
Language Statement Such
Are Compilers HLLs. Break
BRK
Directive allows users
Handling Exceptions in the MI Program
Hexadecimal representation of the message id
String 1202 Where 0C12 =andX 02 02= .X While most
Following is an updated view of the MI01 program
Excid
Creating an MI Version of Clcrtpg
Program Flow for Creating the Micrtpg Program
Qprcrtpg .API
Source for CL04 follows
Source for CL03 follows
Source for CL05 follows
Source for Micrtpg follows
Source for the Micrtpg Program
Following, however, are new statements
Code
Declaring the Structure
Understanding the Micrtpg Program by
Usrspc
Declaring Pointers
Usrspcobj
Enhanced Version
Understanding the MICRTPG2 Program by Sections of Code
Creating the Micrtpg Program
Calling
Instruction stream, create the space
Establish addressability to the Crts template
Qcmdexc API
Binoffset
Ovrdbf
CLOVRLNG@ ARG
DCL DD Cldltcmd CHAR12 Initdltovr Misrc
DCL Spcptr CLOVRLNG@ Initclovrlng
DCL Spcptr CLDLTLNG@ Initcldltlng
Storage
Beginning the Instruction Stream
To Your Advantage
Indicate that the program is done
MICRTPG2 Complete Program-MI Code Example
Delete the previous Ovrdbf
Call the Qprcrtpg API to create the MI program
DCL Spcptr Usrspc DCL Sysptr USRSPC@
DCL DD Numparms BIN
DCL Spcptr PGMOPTS@ Initpgmopts DCL DD Numopts BIN4 INIT3
DCL Sysptr QTEMP@ Baspco
Crts MI
DCL VAR&OFFSET TYPE\DEC LEN15 Loop Rcvf
Updated CL06 Program
Following is the updated CL06 program
PGM PARM&BUFFER &OFFSET Dclf Filemisrc DCL
Qtemp
Creating the MICRTPG2
Handling Exceptions
Its Consolidated State This Is the new MICRTPG2 program
Example
Machine Interface Programming7-29
CTXQSYS, Typepgm
Retexcpd
INT
DCL Sysptr QTEMP@ Defpco
MI Common Programming Techniques-Examples
Entry \ EXT
DCL Spcptr SEPT@ Defpco
DCL DD Sbytavl
DCL DD Matctxopts CHAR44 DCL DD Matctxctl
POS
DCL DD Sreceiver CHAR8 BDRY16 DCL DD Sbytprv
DCL DD Objentry
DCL DD Lextattr
Deflreceiver
DCL DD Lentry
Cpynv LBYTPRV, Sbytavl
SRECEIVER@, QTEMP@, Matctxopts
Cmpnvb SBYTAVL, 96 / Eqdone
LRECEIVER@, Sbytavl
API before Developing Your Cations
AS/400 Program Storage
Process Allo Cating Initializing automatic Storage
APIs
Backup Recovery
Provides Way to That
Is only provided Service Program
Communications APIs
OptiConnect APIs
Configuration APIs
Returns a list of configuration descriptions, based on a
Debugger APIs
Debugger
Low-level services
Window services
Dynamic Screen Manager APIs
An edit Code
Session services
Edit Function APIs
File APIs
Qdls
Hierarchical File System
Hardware Resource APIs
ILE CEE APIs
Cobol APIs
Commitment Control APIs
Journal and Commit APIs
Message Handling APIs
Journal APIs
Data
National Language Support APIs
Network Management APIs
National Language Support APIs
Alert APIs
SNA/Management Services Transport SNA/MS Transport APIs
Change Request Management APIs
Object APIs
Node List API
Filter
Following describes
Clear Data Queue Qclrdtaq Retrieve Description
Lifo
Usridx
User Index APIs
8APIs-13
Chglibl
Object APIs
Conversion Exit Programs Which Are Discussed Under Office
Office APIs
Movobj
Allows you to rename and mov
MSF
File Server APIs
Office Exit Programs
Most Functions
Performance Collector APIs
Print APIs
Print APIs
Filtering
Problem Management APIs
Error Reporting APIs
Program and CL Command APIs
Working with a Problem
Problem Log Entry APIs
Software Product APIs
Security APIs
Getenv
UNIX-Type APIs
Environment Variable APIs
Queues
Integrated File System APIs
Interprocess Communication APIs
Has Exec Function
Are identifie
Signal APIs
An X/Open Specification As a mechanism by which a process
Semaphore
Action
Signal
MIB
IDa
Server Client
Sockets APIs
UIM
User Interface APIs
Process-Related APIs
UIM Advantages
Support
DDS Advantages
Work
Work Management APIs
Process
Miscellaneous APIs
Miscellaneous APIs
List APIs
Find Field Numbers List
Qgyoljbl API
Task
Programming errors and refers you to
That show you how to avoid Errors
Using the error code
Is shown at .2/locationinthe incorrect and correct coding
Using the Error Code Parameter
Incorrect
Xxxxxxx
Csetonlr
Using the Error Code Parameter-Example of Correct Coding
Call Quscrtus Parm Spcnam
Parm SIZ Intval Parm \ALL
Parm Extattrextatr 1ð
Length Through This
Defining Data Structures
Incorrect Coding
Length is Defined Through
Jstat
\ SET UP to Accept Exceptions ADD\ZEROS
Jobnbr
Jobid
Defining a Data Structure-Example
Coding
List Entry from the Space
Intval \ SET UP to Accept Exceptions ADD\ZEROS
\ Create the Space to Hold the Data Call Quscrtus
\ Call the API to List the Active Jobs Qusljob
\ Delete the Space That Held the Data
RPG
When Defining Receiver Variables
When Run Lists All Active Jobs System
May Written Over with These extra characters. On Call
Qusbn \ Retrieve the List Entries Qusbpq ADD Start
Qusbn \ Call the API to List the Active Jobs Qusljob
Qusbn \ Retrieve the Offset
ADD1 Start
\\ JOB Name Structure for Calling Qusljob Ijobnam \ALL
Qusgen
Qusbn \ Retrieve List Entries Qusbpq ADD Start
\\ Data Structure Containing Space NAME/LIB Ispcnam DS
Defining
Incorrect
ADD1 Dowlequsbps
Qusbn \ Call the API to List the Active Jobs
Format Lengths-Example Correct
Coding
Movelqusdd Recvr
Recvr ADD Start END \ Delete the Space That Held the Data
ADD\ZEROS
ILE
Null
Null
Using Null Pointers with OPM APIs-Example of Correct Coding
20System API Programming V4R1
\CURLIB
Correct Byte Alignment ensures that data used With an
Byte
QusVlenRec4t descrec Char Desc5ð Addepattributes
This is a Test Exit PROGRAM,27
ILE C
Defining Byte Alignment-Example Correct
EXAMPLEPGMEXAMPLELIB, Example Exit Program Data
Point For Beginning Read User
Using Offsets in a User Space
Using Offsets in a User
Incorrect
\FLAG Reason Level Date Pgmr
Iobject \ALL
Copy QSYSINC/QRPGSRC,QUSLOBJ
Iusersp APIUG1
Qgpl
Lendta
Qusbpj Ifeq C Oreq P
Qusbps
ADD1 Count Addqusbpq Strpos
User Space-Example
Using Offsets in a
Correct Coding
\FLAG Reason Level Date Pgmr
Call Quscrtus Parm
Iusersp APIUG1 Usrspc Qgpl Spclib
Iobject \ALL Objnam Qgpl Objlib
Qusbpq ADD Strpos
Oreq
Exsr Errcod Seton Retrn
For
Coding for New Function
\FLAG Reason
Dspcname Inzadopts Qtemp Dspcsize
Dspcinit
Qusfn
Qusua
Qussgh
Qussrl
QSYOBJT12
QSY
Pgmr Change Description
Dqsyobjph Basedlstptr
Qusis Ifeq Oreq
Proces Begsr
Move Qusis
Lststatus Doueq
Exsr Done END
Qusis Ifeq
Eval Lstptr = %ADDRARRQUSOIP +
END Else
Qusei Ifeq
Eval Qusbprv = %SIZEQUSEC
Call Qusrobjd Parm Rcvvar Rcvvarsiz
Robjdfmt Parm Spcname \USRSPC Objtype Qusec
PGM, or
Coding for New Function-Example Correct
Does Not match
9B ð INZ1
Basedspcptr
Lupa
46System API Programming V4R1
Dsply Else
Else QSYOBJT12 Ifeq
Ifeq \BLANKS Move
QSYOBJT12 Ifeq \SRVPGM
Eval Lstptr = Addrarrqussee + END
Eval Lstptr = Addrarrqusoip +
Parm Qusec
Call Qsylobjp Parm Spcname
Mbrlist Parm \CURRENT Usrprf
Objtype Parm
Parm \USER Spcdomain
RPG Example on page A-3
Packaging Your Own Software Products
Software products
Dltlib ABC
Packaging a
Object Description
CL Program for
Crtpnlgrp ABC/ABCPNLGRP ABCDEV/QPNLSRC +
Crtdspf ABC/ABCDSPF ABCDEV/QDDSSRC +
Crtpf ABC/ABCPF ABCDEV/QDDSSRC +
Crtcmd ABC/ABC ABC/ABCPGM ABCDEV/QCMDSRC +
Copy QSYSINC/QRPGSRC,QSZCRTPD
Phone
Copy QSYSINC/QRPGSRC,QSZCRTPL
Copy QSYSINC/QRPGSRC,QSZPKGPO
Textd
Qszbcb
Exsr Cobjd
Exsr Pkgpo
Prddfn Begsr
Parm Qszbf
Movelqszcrtpdapi
Parm Qszbc
Parm Qszbd
Qszbk
Movelqszcrtplapi Call Qszcrtpl
Qszbh
Qszbj
Pkgpo
Cobjd
Move OBJ,I Objds Name CAT ABC
Cobji
Parm \NO
MOVEL\ALL Qszbrf
Movelqszpkgpoapi Call Qszpkgpo Parm Qszbr
Parm \YES Repkg
Retriev
Command B-129
Qszrtvpr API
Rtvfd
\CHANGE
\INT
\LCL
Queue entries are manipulated. F
Using Data Queues versus
User
Data Queue-ILE C Example
Example
User Queue-ILE C Example
Queuelib
18System API Programming V4R1
Valid
\USER
Appendix A. Performing Tasks Using APIs-ExamplesA-21
22System API Programming V4R1
Additional Languages
Appendix
Jobdapi
Original Program Model OPM APIs-Examples
Hold Parameter Exception Message-ILE C
Example on For the original
Appendix Original Examples in Additional
Identification Division
Message-ILE Cobol
Copy Qusec of QSYSINC-QLBLSRC
Procedure Division Using JOBD, JOBDL. .8/ MAIN-LINE
Cobol
PROGRAM-ID. Jobdapi Environment Division
Copy QSYSINC/QRPGLESRC,QUSEC
Move Jobd to JOB-DESC. Move Jobdl to JOB-DESC-LIB
Move HOLD-JOB-QUEUE to Hold
Dformat
Dcmdstring
INZ Tousrqpgmr
Drcvlen
Handling Error
Call Qwdrjobd
Exsr Error
Error Begsr
Jobd CAT Jobdlib Lfnam
Jobdapi
Appendix B. Original Examples in Additional BLanguages-11
Identification Division
Perform Errcod
Procedure Division Using JOBD, JOBDL. MAIN-LINE
Move 16 to BYTES-PROVIDED
Copy QSYSINC/QRPGLESRC,QWDRJOBD
Call Qcmdexc Using MESSAGE-TWO, COMMAND-LENGTH, Stop RUN
Call Qwdrjobd Parm
DCMDSTR2
Msgid INZ Tousrqpgmr
Dlenstr INZ%SIZECMDSTRING DLENSTR2 INZ%SIZECMDSTR2
Parm LENSTR2 Endsr
Accessing the Hold Attribute-ILE C Example
Movel Qusei Msgid Call Qcmdexc Parm
File
PROGRAM-ID. Jobdapi
Hold Attribute-ILE
LIST-LINE
Data Division File Section
Label Records are Standard
Data Record is LIST-LINE
BAD Open Output Listing Move EXCEPTION-ID to Msgid
Attribute-OPM RPG Example On page 3-17 f Original
Refer To Accessing
Oqprint BAD
Except Good Else
Except BAD END
Oqprint Good
Appendix B. Original Examples in Additional
24System API Programming V4R1
For Original example. The following program also
Refer Accessing Field Value Initial Library List-OPM
List-ILE Cobol Example
Value Qwdrjobd
Roch
BYTES-AVAILABLE
JOB-SWITCHES PIC
DEVICE-RECOVERY-ACTION PIC
BYTES-RETURNED
Perform NUMBER-LIBS-IN-LIB-LIST Times
Call Qcmdexc Using COMMAND-STRING, COMMAND-LENGTH, ADD 11 to
Reclen
List-ILE RPG
Qwdbavl
Qwdbrtn
Qwdjd
Qwdjdn
Qwdjdln
Qwdun
Qwdjmqfa
Qwdord
Qwdlrd
Qwdjmqms
Call Qcmdexc Parm Cmdstring Lenstr ADD
Using Keys with List
Exsr Error Else
Qwdoill ADD Qwdnlill Eval
Quslspl
Appendix B. Original Examples in Additional BLanguages-35
36System API Programming V4R1
Appendix B. Original Examples in Additional BLanguages-37
Pages
Using Keys with List Spooled Files API-ILE Cobol Example
Prtfil PIC
Filler PIC
Misc SPC-NAME PIC
Opndat PIC
Lsterr TEXT1 PIC
Hdrerr TEXT2 PIC
KEY-INFO
Procedure DIVISION. MAIN-LINE
Call Qusptrus Using SPC-NAME, SPCPTR, QUS-EC
Perform Proces
SET
STRING-SPACE Spcptr SET
STRING-SPACEOFFSET-LIST-DATA
Dlstptr DLSTPTR2 Dspcptr
Using Keys with List Spooled Files API-ILE RPG Example
To Opndat
Inzspcname Qtemp Dspcsize
Appendix B. Original Examples in Additional BLanguages-43
\ QUSERVED35
Dqussplki
BASEDLSTPTR2
\QUSERVED34
Format Parm \CURRENT Usrprf
Parm \BLANKS Spctext
Parm Qusec \USER
Call Quslspl Parm Spcname
Move \BLANKS Prtfil Eval
AGE CAS Error END
Eval LSTPTR2 = %ADDRARRX END Except Prtlin
Filnam Begsr
Integrated
APIs-Examples
Exit
Cobol Example
VAR-OFFSET
BAD-REG TEXT1 PIC
EXCEPTION-ID PIC
BAD-ADD TEXT1 PIC
Move 4 to CONTROL-KEY of QUS-VLEN-REC-4
Move 2 to NBR-RECORDS
Move 3 to CONTROL-KEY of QUS-VLEN-REC-4
Move Exit Point Example
Register Exit Point
By Content Length of EXIT-PGM-DATA of MISC, VARREC, QUS-EC
TEXT1 PIC
X1ððð Ð1 Misc
EXIT-POINT-NAME of MISC, FORMAT-NAME of MISC, VARREC, QUS-EC
RPG
Iovrlay
Printer \ Compile Time Array REC
Copy QSYSINC/QRPGSRC,QUS I\
Ivarrec
Binary ADD Moveabinc REC,OF Exsr Calcvo ADD8
ADD2
ADD3
ADD4
Qusbnc Ifgt Open
REC,OF Exsr
ADD37 Binary Moveabinc REC,OF Exsr
Call Qusaddep
Copy QSYSINC/QRPGLESRC,QUS
Errept
Errpgm
Printer OFLIND\INOF Usropn
Doverlays Binary
Dvarrec Nbrrecs
Recs
Dvoffset
Open Qprint Except Erraepnt Exsr Done Endif
Callb
Parm Epntname
Format Parm Varrec Qusec
Information-OPM Cobol
Misc EXIT-POINT-NAME PIC
PROGRAM-ID. REGFAC2 Environment Division
EXCEPTION-ID
BAD-CREATE TEXT1
Value Rcvvar Qtemp SPACE-ATTR PIC
FORMAT-NAME-1 PIC
FORMAT-NAME-2 PIC
BASE-POINTER Pointer INFO-POINTER SPACE-NAME PIC
Move Spaces to CONTINUATION-HDL
Call Qusptrus Using SPACE-NAME, BASE-POINTER, QUS-EC
CALL-EXIT-PROGRAMS
Else Stop RUN
Perform CALL-EXIT-PROGRAMS
To CONTINUATION-HDL
CALL-PGMS
Write LIST-LINE from BAD-EXIT-PGM, Stop RUN
To Address of RCVVAROFFSET-PROGRAM-ENTRY
Perform CALL-PGMS
Value -1 Binary
Value Exampleexitpoint
EXIT-PGM-NBR
68System API Programming V4R1
Appendix B. Original Examples in Additional BLanguages-69
Open Output Listing Move EXCEPTION-ID of QUS-EC
Appendix B. Original Examples in Additional BLanguages
Call Qusrtvei Parm Conthd RCV Rcvsz
Copy QSYSINC/QRPGSRC,QUSREG
Ircv
Move \BLANKS
SUBSTRCV1
Parm Epntnm
Parm Epgmnb
Qusccb
Quscjg
Parm RCV Rcvsz
Quscj
ADD Quscjf Substrcvy
\ Based
Information-ILE RPG Example
Done Begsr Seton Retrn Endsr Oqprint
Qusbnd Oqprint
Qusppf
Dquspe
Qusppn
Quspplib
Qusco
Qusmlib
Qusmi
Dqusse
Qusacc
Qusmep
Qusnbrep
Qusad
Quspgml
Qusone
Qusce
Quspgmn
Quslpgme
Qusled
\QUSPD
Qusopgme
Quslpd
QUSFN12
Qusmfill
Qusopd
Depntname Inzexampleexitpoint Depgmnbr
\ QUSFN13
\ QUSERVED11
Qusrei
Epntfmt Parm Epgmnbr Qusnbrsc Qusec
Move \BLANKS Continhdl
Callb Qusrei Parm Continhdl Rcvvar Rcvvarsz
Format Parm Epntname
Cusrei Begsr
DOW
Exsr Cusrei Enddo Endif Done
Begsr Eval
Remove Exit Program
Parm Exitparms
Eval Infspcptr = %ADDRRCVVARQUSONE+1 Enddo Endsr
PGM-NBR
Call Qusdrgpt Using EXIT-POINT-NAME, FORMAT-NAME, QUS-EC
PROGRAM-ID. REGFAC3 Environment Division
EXIT-POINT-NAME, FORMAT-NAME, QUS-EC
Exampleexitpoint Epntnm
Call Qusdrgpt
Parm Pgmnbr Qusbn
Dpgmnbr
Qusrepgm
Callb Qusdep Parm Epntname
Callb Qusrepgm Parm Epntname
Format Parm Pgmnbr Qusec
Object
API-ILE C
Appendix B. Original Examples in Additional BLanguages-95
96System API Programming V4R1
Appendix B. Original Examples in Additional BLanguages-97
98System API Programming V4R1
Appendix B. Original Examples in Additional BLanguages-99
100
INPUT-OUTPUT Section
List Object API-ILE Cobol Example
PROGRAM-ID. Listadopt Environment Division
102
Address of STRING-SPACE
Procedure Division Using USR-PRF, OBJ-TYPE. MAIN-LINE
OBJ-TYPE PIC
Copy Qsylobjp of QSYSINC-QLBLSRC
Perform DONE, END-IF PROCES2
Perform PROCES2
To LST-STATUS, END-IF END-IF, END-IF Else
Move Qusrobjd to APINAM, Perform Apierr
Move Qsylobjp to APINAM, Perform Apierr
Move Length of QUS-EC to BYTES-PROVIDED of QUS-EC
Move Quscrtus to APINAM, Perform Apierr
Write LIST-LINE from END-LIST. Stop RUN
106
Move Qusptrus to APINAM, Perform Apierr
Display Apinam Display EXCEPTION-ID of QUS-EC. Perform Done
Dlstptr Dspcptr Darr Basedlstptr DIM32767 Drcvvar
Inzadopts Qtemp Dspcsize
QSYOBJT14
108
QSYOBJT13
QSYOBJA11
Lststatus
Qusnbrle Except Objentry
Eval Lstptr = %ADDRARRQUSSEE + 1 END
Robjdfmt Parm Spcname \USRSPC Spctype Qusec
Exsr Getlst Move Qusis Lststatus END Else
Mbrlist Parm Usrprf Objtype Continhdl Qusec
CPF98ð1
Logging
Pointers-Examples
CBLERR1 Program
Without
ERRHDL1 \LIBL Scope PIC
ERROR-HANDLER PIC
PROGRAM-ID. CBLERR1
PROGRAM-ID. ERRHDL1
PRIOR-ERROR-HANDLER of MISC, QUS-EC
ERRHDL1 Program
ADD X to Y
Binary Value PRINT-JOBLOG PIC
Misc LOG-EXCEPTION-ID PIC
MESSAGE-KEY PIC
POINT-OF-FAILURE PIC
Move C to SYS-OPTION. Stop RUN
Logging Software Error OPM
Move 1 to MSG-OFFSET
LIBRARY-NAME
Imisc
SRC TGT
Ipsds
Excpid
FACT1 DIV FACT2 Result
Switch
FACT1
FACT2
API without Pointers-ILE C Example
Logging Software Error OPM API without Pointers-ILE
Dpsds SDS
120
Appendix B. Original Examples in Additional BLanguages-121
Reporting
This section includes the examples Reporting Software Error
Refer to Reporting Software Error ILE
CBLERR2 Program
NUMERIC-GROUP PIC
ERROR-HANDLER
Copy Qusec of QSYSINC-QCBLLESRC
Copy Qpdsrvpg of QSYSINC-QCBLLESRC
ERRHDL2 Program
PROGRAM-ID. ERRHDL2
CBL-PGM-NAME
Procedure Division Using CBL-EXCEPTION-ID
MESSAGE-LENGTH
SYS-OPTION PIC
Software
RPG Example
126
Dpsds
Copy QSYSINC/QRPGLESRC,QPDSRVPG D\
Inzrc
128System API Programming V4R1
Sftwprdex
This Section Includes the examples Packaging Your
Software Produ
130System API Programming V4R1
Object ABCðð29 MRI object For Product
132System API Programming V4R1
Qclsrc ABC
ABCPGMMRM2ABC
ABCPGMMRI1ABC
ABCPGMMRI2ABC
134
Appendix B. Original Examples in Additional BLanguages-135
PROGRAM-ID. Sftwprdex Environment Division
Program for Packaging a Product-ILE Cobol Example
Qszcrtpd
Qszpkgpo
API-NAME PIC
Copy Qszcrtpd of QSYSINC-QLBLSRC
Copy Qszcrtpl of QSYSINC-QLBLSRC
Copy Qszpkgpo of QSYSINC-QLBLSRC
PID13 PIC
Numkey
KEY13
LEN13
Prddfn
Perform Prdlod
Perform Cobjd
Perform Pkgpo
Prdlod
Call Qszcrtpd Using PROD-NAME, QSZ-PRD-INF, QSZ-PRD-OPT
Move Spaces to Reserved of QSZ-LNG-LOD
Move Qszcrtpd to API-NAME, Perform Errcod
Move ABCPGMMRI1 to PRE-EXT-PGM of QSZ-PRE-EXT
Move Qszcrtpl to API-NAME, Perform Errcod
Move ABCPGMMRI2 to POST-EXIT-PGM of QSZ-LIB-INF
Move Qlicobjd to API-NAME, Perform Errcod
Open Output LISTING, Move 1 to FIRST-ERR
Call Qszpkgpo Using QSZ-PRD-OPT-INF, REPKG, ALWCHG, QUS-EC
Move Qszpkgpo to API-NAME, Perform Errcod
Product-OPM RPG Example on page A-3 fo Original
144
Packaging a
Refer To Program For
Dapiname Dfirsterr
Dcobji Numkey
PID13 KEY12
LID12 KEY5
Parm Prodname Qszpi Qszpo
146
Eval Qszamr = \NO Qszridt = \PHONE
Eval Qszadn = \NODYNNAM
Eval Qszlt = \CODE Qszlid = \CODEDFT
Parm Qszll
Parm Pubaut Qusec
Exsr Errcod Endif Endsr
148
Cobjd Begsr
Parm Qszal
Parm Qszpe Nbrpe Qszfl
150
Qusei \\CTDATA Objinfo
Open Qprint Eval Firsterr = Endif
Endsr Oqprint Badnews
Apiname
SPACE-INIT PIC
Space-Examples
Space-ILE Cobol Example
FILE-USED PIC
EXT-ATTR PIC
Overrides PIC
System PIC
FORMAT-1 PIC
Display API-NAME
Call Qusptrus Using SPACE-NAME, SPACE-POINTER, QUS-EC
API-ERROR-FOUND
SET Address of QDB-QDBFH to SPACE-POINTER
To a User Space-ILE RPG Example
156
Qdbfwtfi
Qdbfhupl
Qdbfhmxm
\NOMAX
QDBRSV11
Qdbfhfrt
Frcratio
Qdbhmnum
Qdbfhcrt
Qdbfvrm
\QDBQAAF2 QDBBITS31
QDBRSV17
160
QDBRSV24
QDBRSV23
Qdbffigl
Qdbfmxrl
Qdbpfof
Fcfo Fifo Lifo
Qdbfhrls
QDBRSV27
Dsystem INZ\LCL DFORMAT1 INZ\INT Dchgattr Nbrattr
QDBRSV28
Dspcname Dfilename Dfmtname Dfileused Dlibname Dspcsize
Dspcptr Dformat Doverrides
Qusbavl Ifgt Movel Quscusat Apinam Exsr Apierr END
Call Quscrtus Parm Spcname \BLANKS Extattr
Spcsize Parm Spcinit \CHANGE Spcaut Qdbrtvfd Spctext
Call Quscusat Parm Libname Spcname Chgattr Qusec
Data Queue-ILE Cobol Example
Data Queue-Examples
Crtlib
FIRST-ERROR PIC
PROGRAM-ID. Dqueuex Environment Division
Copy Qcapcmd of QSYSINC-QLBLSRC
MSG-BACK PIC
WAIT-TIME
MSG PIC
Display MSG-BACK
ERROR-FOUND
Move 1 to FIRST-ERROR
Data Queue-OPM RPG Example
170
Qcabc
Exsr Exccmd
Moveldltlib Cmdstr
Exsr Exccmd Seton Retrn
172
Data
Parm Exampleq
Eval Qcamk = \BLANKS Qcaerved = \LOVAL
Eval Cmdstr = Crtlib Lenstr = %SIZECRTLIB Exsr Execcmd
Eval Cmdstr = Crtdq Lenstr = %SIZECRTDQ Exsr Execcmd
174
Theread
UNIX-Type APIs-Examples
176System API Programming V4R1
Appendix B. Original Examples in Additional BLanguages-177
Using the Integrated File System-ILE Cobol Example
Curdir PRT-TEXT PIC
PROGRAM-ID. IFS Environment Division
PRT-TEXT PIC
User PIC
Oflag PIC
Procedure DIVISION. MAIN-LINE Open Output Listing
Testfile
Value LOW-VALUE
If RETURN-INT
Perform ERROR-FOUND
To LIST-LINE Write LIST-LINE
Giving RETURN-INT
Write LIST-LINE. Stop RUN
To LIST-LINE Perform ERROR-FOUND
To LIST-LINE Perform ERROR-FOUND Else
Fqsysprt
ERROR-FOUND Write LIST-LINE
184System API Programming V4R1
BLanguages-185
186
Appendix B. Original Examples in Additional BLanguages-187
Oqsysprt
Books
Bibliography
Books
Bibliography H-3
4System API Programming V4R1
Index
Numerics
API application programming interface
Index
ILE RPG
Index
Chgenvvar
CEE
Dspjobd
Display
Example
Qusrtvei API
Exception
Type EXT
ILE
IPC
Listing
Message key
Management APIs
Assistant Exit Program OptiConnect APIs
PL/I
PL/I API
Retrieve
Qlpcdinf Generate CD-ROM Premastering Infor- mation API
Qusdrgpt Deregister Exit Point API
Qearmvbm API
SAA
Controls
MI instruction
Station
Page
Other countries+1+507+253-5192
How satisfied
Please tell us how we can improve this manual
To return this form
SC41-5800-00
Reader Comments-Wed Like to Hear from You
Page
IBM
IBM