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