Sample Programs for Data Access

The source code and executable files for several sample programs that illustrate using the Microsoft® OLE DB Provider for AS/400 and VSAM, the Microsoft® OLE DB Provider for DB2, and the Microsoft® ODBC Driver for DB2 are included on the Microsoft® Host Integration Server 2000 CD-ROM and as part of the Microsoft Developer Network (MSDN) Platform SDK. These sample programs are located in the \SDK\Samples\DataAccess subdirectory on the Host Integration Server 2000 CD-ROM. These files are also copied to your hard drive during Host Integration Server and Host Integration Client installation when the SDK option is selected.

When installed as part of the MSDN Platform SDK, these samples are located under the Samples\NetDS\HIS\DataAccess subdirectory below where the MSDN Platform SDK has been installed.

These sample programs include the files in the following subdirectories:

SubdirectoryDescription
DRDA_ASPADO sample script written in Microsoft® Active Server Pages (ASP) using the OLE DB Provider for DB2
DRDA_VBADO sample program written in Microsoft® Visual Basic® using the OLE DB Provider for DB2
DRDA_VBSADO sample script written in Microsoft® VBScript using the OLE DB Provider for DB2
RLIO_ASPADO sample script written in Microsoft® Active Server Pages (ASP) using the OLE DB Provider for AS/400 and VSAM
RLIO_VBADO sample program written in Microsoft® Visual Basic® using the OLE DB Provider for AS/400 and VSAM
RLIO_VBSADO sample script written in Microsoft® VBScript using the OLE DB Provider for AS/400 and VSAM

The file named SAMPLE.HCD located in the DataAccess subdirectory contains two examples of a Host Column Description (HCD) file required to access host VSAM files using the OLE DB Provider for AS/400 and VSAM. Please see documentation on the Host Column Description in the Data Access Reference section for more information. The SAMPLE.HCD file is described in this same reference section as well.

Several sample programs with source code are provided with Host Integration Server 2000 that illustrate data access. These sample programs include the following:

  • Visual Basic ADO sample program This application allows you to open a connection through the OLE DB Provider, open a recordset, and browse the records of a host file. Two versions of this sample application are provided. The sample in the DRDA_VB folder is for use with the OLE DB Provider for DB2. The sample in the RLIO_VB folder is for use with the OLE DB Provider for AS/400 and VSAM. Seeking on a key value in a host indexed file is also possible with this sample when the version of this sample is used with the OLE DB Provider for AS/400 and VSAM.
  • Visual Basic Script ADO sample program This VBScript application allows you to open a connection through the OLE DB Provider, open a recordset, and browse the records of a host file. Two versions of this sample application are provided. The sample in the DRDA_VBS folder is for use with the OLE DB Provider for DB2. The sample in the RLIO_VBS folder is for use with the OLE DB Provider for AS/400 and VSAM.
  • Active Server Pages (ASP) sample programs Two ASP sample programs are included. One is a report application that allows you to return and display the first ten records in a host file to a client browser in a table view. The second sample allows you to display columns of a host file in a form view. Two versions of these sample applications are provided. The samples in the DRDA_ASP folder are for use with the OLE DB Provider for DB2. The samples in the RLIO_ASP folder are for use with the OLE DB Provider for AS/400 and VSAM.

Several additional SDK sample files for data access are included with Microsoft Data Access Components (MDAC) SDK and are available as part of the Microsoft MSDN Platform SDK. These data access sample programs include the following files:

Sample ProgramDescription
ODBCQueryThe ODBC Query demo application written in C. This sample can be used with the ODBC Driver for DB2.
RowsetViewerThe OLE DB RowsetViewer sample application written in C++. This sample can be with either the OLE DB Provider for DB2 or the OLE DB Provider for AS/400 and VSAM.

These sample programs with source code are provided as part of the MDAC SDK and the MSDN Platform SDK can be used with the data access features of Host Integration Server 2000:

  • OLE DB RowsetViewer sample program This application written on C++ allows you to connect to the OLE DB Provider, open a table window, type the host file name or database, return a rowset, and browse the contents. You can navigate the table, using seek and set range on indexed files when the version of this sample is used with the OLE DB Provider for AS/400 and VSAM.

Before running any of these examples with the OLE DB Provider for AS/400 and VSAM, it is necessary to create a data file on the SNA host that will be used for demonstration purposes. After a suitable file is created on the host, it is necessary to run the Data Descriptions management console snap-in application in order to configure the appropriate default settings for the OLE DB Provider for AS/400 and VSAM, such as APPC mode, the character code set Identifier (CCSID) to be used when converting host data, and the Code Page to be used on the local PC.

If the data is on a mainframe host, it is also necessary to configure a data description (create a host column description file) using the Data Descriptions management console snap-in. The host column description specifies the column description of the data file on the host and how the OLE DB Provider for AS/400 and VSAM should convert data from the host to the PC. Although an HCD file is unnecessary to access data files on the AS/400, a host column description can be specified that will override the default conversions.

The following sections discuss setting up and using each sample application in more detail.

Show: