IBM Support

IBM i Access for Windows Toolkit - C and C++

General Page

A listing of sample programs to help develop IBM i Access for Windows applications using C and C++.

c,c++,windows toolkit,ibm i access for windows toolkit

The following sample programs are available to help develop IBM i Access for Windows applications using C and C++:


C/C++ APIs

  • adsamp1.exe – Demonstrates correct method to determine the version and release of IBM i Access for Windows on the PC.

    This sample illustrates the correct method to determine the version and release of IBM i Access for Windows. This method will return valid values for any release of IBM i Access for Windows 95/NT and also IBM i Access. The sample is written in C++ and has no MFC dependencies.

  • coconsce.exe – Use of Communications System Object APIs in various connection scenarios.

    This sample demonstrates how an application might use the IBM i Access for Windows Communication APIs related to System Objects. In this example, these APIs are used to create system objects and to set their attributes according to the security and performance requirements of various scenarios. The system objects are then used to run remote commands (using the Remote Command APIs and Service APIs) and to validate user IDs and passwords, and the behavior and some elapsed times can be observed by the user.

  • cogetsys.exe – Demonstrates using Communications APIs.

    This module is used to demonstrate how an application might use the Communication APIs. In this example, these APIs are used to get and display the list of all configured systems. The user can choose either to be shown all of a system's connection properties (the attributes of the created system object), or to have the ability to connect to all IBM i Access for Windows systems checked. APIs that deal with the System List as well as APIs that deal with individual System Objects are used.

  • convsamp.exe – Sample using the cwbNL_ConvertCodePages API to perform code page conversion on files.

    This sample demonstrates how an application might use the cwbNL_ConvertCodePages to convert files between ASCII and EBCDIC.

    The sample expects four parameters:

    1. source file name
    2. source code page
    3. target file name
    4. target code page

    The sample reads the source file, converts it from the source code page to the target code page, and saves the result to the target file.

  • dbapisp1.exe – C programs that demonstrate use of the Database APIs (also referred to as Optimized SQL APIs).

    This is a group of small C programs that demonstrate the use of all three categories of database APIs--Catalog, SQL, and Native Database--to do the following:

    • Retrieve information about objects (libraries, files, fields, etc).
    • Create a file, override members and use block insert to put records into the different members.
    • Add a library to the user's library list, get a library list and step through it, and look for a library on the system.
    • Use SQL APIs to query a database table.
  • dirupdat.exe – C/C++ sample program showing a simple example of setting up Directory Update entries.

    This C/C++ sample program demonstrates creating, configuring, and deleting Directory Update entries. A "Create Update Entry" interface is included, where the required options of an update entry are gathered. This code path calls Directory Update APIs to create the update entry, and an API to set the attributes of the update entry. A "Delete Update Entry" interface is also included. This code path calls the Directory Update APIs necessary to delete an update entry.

    It should be noted that the Directory Update APIs only set up the update entries to be used by the Directory Update application. The Directory Update APIs do not perform the file updates that result from the update entries. The Directory Update application performs the actual update function.

    For more detail on Directory Update, and package file support, read the IBM i Access for Windows User's Guide (that is installed on your PC when IBM i Access for Windows is installed).

  • dqsamp.exe – Data queue sample written in Visual C++ 4.2 using MFC and the Data Queue APIs.

    This sample uses the IBM i Access for Windows Data Queue APIs to do simple client/system transaction processing and keyed storage. The interface uses the Microsoft Foundation Classes (MFC) for displaying graphical dialogs, storage objects, and for Windows message processing. The code that does the actual data queue operations consists of a set of classes which call the Data Queue APIs.

    Two separate types of data queues are used in the sample. A First-In First-Out (FIFO) queue for transaction messages and a keyed queue for item storage. These queues may reside on different systems.

  • hllsmp.exe – C sample using the PC5250 Emulation EHLLAPI interface.

    This sample shows how to request keystrokes and log on to a IBM i, using the PC5250 EHLLAPI interface.

  • logtrace.exe – Sample program showing usage of the IBM i Access for Windows service log and trace APIs.

    This module is used to demonstrate how an application might use the IBM i Access for Windows Serviceability APIs. In this example, these APIs are used to log a message to the history log, and log trace points to the detail trace file.

  • lstjobx.exe – Display a list of jobs.

    This program uses the System Object Access APIs to display a list of jobs. The list is displayed in a "spreadsheet" form allowing the user to perform actions on the jobs in the list.

  • lstmsgx.exe – Display a list of messages.

    This program uses the System Object Access APIs to display a list of messages. The list is displayed in a "spreadsheet" form allowing the user to perform actions on the messages in the list.

  • lstprtx.exe – Display a list of printers.

    This program uses the System Object Access APIs to display a list of printers. The list is displayed in a "spreadsheet" form allowing the user to perform actions on the printers in the list.

  • lstsplfx.exe – Display a list of spooled files.

    This program uses the System Object Access APIs to display a list of spooled files. The list is displayed in a "spreadsheet" form allowing the user to perform actions on the spooled files in the list.

  • pcsmain.exe – C sample using the PC5250 Emulation PCSAPI interface.

    PCSMAIN provides a sample dialog that allows you to start, stop connect, and disconnect PC5250 sessions, and perform a simple query to determine the session status as well as to find out what .ws is associated with the session.

  • printobj.exe – Sample using the system Object APIs to provide access to objects related to printing: printers, spooled files, output queues, etc.

    This sample, when compiled and linked with Microsoft Visual C++, will allow access to spooled files, output queues, writers, printer devices and lists of printer files and libraries. It generates a file named smplnpob.exe which can be run from a DOS command prompt. The source code for this sample provides coding examples which use the cwbOBJ_ set of iSeries Access for Windows APIs.

  • rcsamp1x.exe – Demonstrates the use of the Remote Program Call API.

    This sample demonstrates using the IBM i Access for Windows Remote Program Call APIs, National Language Support APIs, and the Service APIs to call an OS/400 API and return its output to the PC.

  • rcsamp2x.exe – Demonstrate the use of Run Comand API.

    This sample demonstrates using the IBM i Access for Windows Run Command API to call an OS/400 command and if an error occurs, retrieve message help for the error message.

  • usfsampl.exe – Demonstrates the use of the Ultimedia System Facilities (USF) APIs.

    This USF sample uses some of the USF APIs to perform the following:

    • Obtain an USF conversation
    • Release an USF conversation
    • Present an USF multimedia object
    • Present a multimedia file that is not imported into the USF multimedia system
    • Query USF objects with a specified attribute value.
    • Retrieve an USF object's attributes
  • wdtsampx.exe – Sample program to show how to use the IBM i Access for Windows Data Translation API.

    This program allows the user to pick which translation should be executed from a standard Windows pull-down menu. For each type of translation there is a dialog box that will be displayed on the screen to allow the user to enter values to be translated. When the OK button is pressed, or the enter key is pressed with the cursor in the entry field, the translation will be performed and the results will be displayed. This process will continue until the Cancel button is pressed.


ODBC

  • odbcsmpl.exe – C Sample Program using the IBM i Access for Windows ODBC Driver.

    This code demonstrates how to use the IBM i Access for Windows ODBC Driver to perform basic SQL tasks, including:

    • creating a table
    • inserting records into a table
    • retrieving a table name
    • retrieving a column name
    • retrieving rows from a table
    • dropping a table

[{"Product":{"code":"HW1A1","label":"IBM Power Systems"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Component":"--","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"Version Independent","Edition":"","Line of Business":{"code":"LOB57","label":"Power"}}]

Document Information

Modified date:
03 May 2021

UID

isg3T1027177