Examples: APIs and exit programs
These examples show how to use a wide variety of APIs and exit programs.
Note: To use these examples, you need the header files
in the system include (QSYSINC) library.
- Example: Changing an active job
This command interface to the Change Active Jobs (CHGACTJOB) program can reduce the run priority of active jobs with the same name. - Example: Changing a job schedule entry
This command interface to the Change Job Schedule Entry User (CHGSCDEUSR) program can change the user for a job schedule entry. - Example: Creating a batch machine
These ILE C programs emulate a batch machine. One program acts as a requester and puts the entries into a user space. The other program acts as a server, takes the entries from the user queue, and runs the request. - Example: Creating and manipulating a user index
This example shows how to create and manipulate a user index with a call from an MI program. - Example: Creating your own telephone directory
These ILE C programs show how to create a user index for a telephone directory, how to insert entries into the telephone directory, and how to find an entry. - Example: Defining queries
These ILE C programs show how to use the Query (QQQQRY) API to define a simple query for ordering; a join query; and a join query with selection, grouping, and ordering. - Example: Deleting old spooled files
In this example, a user-defined command Delete Old Spooled Files (DLTOLDSPLF) is created, which calls a program named DLTOLDSPLF to delete a list of old spooled files. - Example: Diagnostic reporting
This ILE C program produces a diagnostic report of errors that occur when the Send Nonprogram Message (QMHSNDM) API is used to send a message to multiple message queues that do not exist. - Example: Generating and sending an alert
This ILE RPG program uses alert APIs. First, it calls the Generate Alert (QALGENA) API to generate an alert without sending a message to the QSYSOPR or QHST message queue. Then, it uses the Send Alert (QALSNDA) API to send the alert to the alert manager. - Example: Listing directories
This ILE C program creates a report listing the contents of a directory. - Example: Listing subdirectories
This ILE C program creates a report listing the subdirectories of a directory. - Example: Saving to multiple devices
This ILE C program saves a large library using more than one device at the same time. - Example: Saving and restoring system-level environment variables
These ILE C programs show how to save the current set of system-level environment variables and restore them later. - Examples: Scanning string patterns
These examples use the Scan for String Pattern (QCLSCAN) API to retrieve all database records that contain a pattern. - Example: Using a COBOL/400 program to call APIs
This COBOL/400 program creates a pending run unit and sets an error handler for the pending run unit. - Examples: Using the Control Device (QTACTLDV) API
These programs show how to call the Control Device (QTACTLDV) API to issue a diagnostic command to a tape device and to display the firmware level of the tape device. - Examples: Processing data queue entries
Your program can use different methods to process data queue entries. - Example: Using environment variables
This ILE C program displays the value of an environment variable and sets the environment variable to a new value. - Examples: Using ILE Common Execution Environment APIs
These ILE COBOL and ILE RPG programs call the ILE Common Execution Environment (CEE) APIs for date conversions. - Example: Using generic terminal APIs
These example programs implement a generic terminal and a simple interpreter. - Example: Using profile handles
This example shows how to use APIs to generate, change, and release profile handles in a CL program. - Example: Using registration facility APIs
These ILE C programs show how to register an exit point, how to add an exit program to the exit point, and how to call the exit program based on the exit point information that is retrieved. - Example: Using semaphore set and shared memory functions
This example illustrates programs that support the client/server model. - Example: Using SNA/Management Services Transport APIs
This example shows a source and target application in ILE C that use the Systems Network Architecture (SNA) Management Services Transport APIs to send and receive management services data. - Example: Using source debugger APIs
The ILE source debugger APIs allow an application developer to write a debugger for ILE programs. - Example: Using process-related APIs
These ILE C programs perform process-related functions in a parent-child relationship. - Example: Using the user-defined communications programs for file transfer
This example shows how X.25-oriented applications use the user-defined communications support to connect to remote systems. Two user-defined application programs, written in ILE C, are used to illustrate a simple file transfer between systems over an X.25 packet-switching data network (PSDN). - Example: Working with stream files
This ILE C program writes data from an existing stream file to a new database file. - Example: Creating a program temporary fix exit program
This example exit program, written in CL, covers these possible changes in the logical state of a program temporary fix (PTF): loaded to temporarily applied and temporarily applied to temporarily removed. The example program shows where you can add your code. You can write a PTF exit program in any programming language. - Example: Creating an exit program for Operational Assistant backup
This example shows a user-written exit program, written in CL, for doing Operational Assistant backup.
Parent topic: Application programming interfaces