PK
E-Aoa, mimetypeapplication/epub+zipPK E-A iTunesMetadata.plistS
You must convert datatypes and data formats properly when you are using the PGAU tool to generate TIPs and when you are developing a custom TIP using PL/SQL and the UTL_RAW
and UTL_PG
functions.
Read this appendix to learn about datatype conversion as it relates to TIPs.
This appendix contains the following sections:
PGAU-generated TIPs perform length checking at the end of every parameter sent and received.
Table D-1 provides a list of length parameters generated by PGAU:
Table D-1 Length Parameters
Parameter | Description |
---|---|
Is computed by PGAU when the TIP is generated. | |
Is summed by the TIP from each converted field. | |
Is the transmitted send data length and is also equal to the actual length for send parameters. | |
Is the transmitted receive data length. |
An exception is raised when the convert length of a sent parameter does not equal its expected length. This occurs if too many or too few send field conversions are performed.
An exception is raised when the convert length of a received parameter does not equal its received length. These length exceptions result when too few or too many conversions are performed.
A warning is issued when the expected length of a received parameter does not equal its convert or received length and data conversion tracing is enabled. This occurs when a maximum length record is expected, but a shorter record is transmitted and correctly converted.
PGAU generates TIPs that support transmission of individual data parameters which exceed 32K bytes.
PGAU includes this support automatically when PGAU GENERATE
processing detects the maximum length of a data parameter exceeding 32K.
This support is driven by the data definitions placed in the PG DD and cannot be selected by the user. To include the support, the data definition must actually or possible exceed 32K. To remove the support, you must decrease the parameter length to less than 32K, REDEFINE
the data, and GENERATE
the TIP again.
This support tests for field positions crossing the 32K buffer boundaries before and after conversion of those fields which lie across such boundaries. In the case of repeating groups, This can be many fields, for repeating groups, or few fields in the case of simple linear records.
Each test and the corresponding buffer management logic adds overhead.
Caution: The target of aREDEFINE clause cannot reside in a previously processed buffer. Run-time TIP processing of the fields containing such REDEFINE clauses get unpredictable results. |
The PG DD and TIPs generated by PGAU support COBOL, specified as IBMVSCOBOLII
when defining data.
When USAGE(PASS)
has been specified on the PGAU DEFINE DATA
statement, the following datatype and format conversions are supported:
PGAU TIPs convert the COBOL X
datatype to a PL/SQL CHAR
datatype of the same character length. Globalization Support character set translation is also performed.
Note: COBOL lacks a datatype specifically designated for variable length data. It is represented in COBOL as a subgroup containing a PIC 9
length field followed by a PIC X
character field. For example:
10 NAME
.
1
5 LENGTH PIC S9(4)
.
15 LETTERS PIC X(30)
.
Given this context, it cannot be guaranteed that all instances of an S9(4)
field followed by an X
field are always variable length data. Rather than PGAU TIPs converting the above COBOL group NAME
to a VARCHAR
, the TIPs instead construct a nested PL/SQL record as follows:
TYPE NAME_typ is RECORD ( LENGTH NUMBER(4,0), LETTERS CHAR(30));
TYPE ... is RECORD( ... NAME NAME_typ, ...
It is the client application's responsibility (based upon specific knowledge of the remote host data) to extract NAME.LENGTH
characters from NAME.LETTERS
and assign the result to a PL/SQL VARCHAR
, if a VARCHAR
is desired.
Character set conversion is performed for single byte encoded:
remote host character data, using either:
DEFINE TRANSACTION NLS_LANGUAGE
character set for an entire transaction, or
REDEFINE DATA REMOTE_LANGUAGE
character set for a single field, if specified.
local Oracle character data, using either:
LANGUAGE
character set of integrating server for an entire transaction, or
REDEFINE DATA LOCAL_LANGUAGE
character set for a single field, if specified.
PIC G Datatype Conversions
PGAU generated TIPs convert the COBOL G
datatype to a PL/SQL VARCHAR2
datatype of the same length, allowing 2 bytes for every character position.
Character set conversion is performed for double-byte and multi-byte encoded:
remote host character data, using either:
DEFINE TRANSACTION REMOTE_MBCS
character set for an entire transaction, or
REDEFINE DATA REMOTE_LANGUAGE
character set for a single field, if specified.
local Oracle character data, using either:
DEFINE TRANSACTION LOCAL_MBCS
character set for an entire transaction, or
REDEFINE DATA LOCAL_LANGUAGE
character set for a single field, if specified.
Alphanumeric and DBCS Editing Field Positions
Table D-2 illustrates how PGAU interprets COBOL symbols in datatype conversions, by providing the definitions for the symbols.
Table D-2 COBOL Symbol Definitions
COBOL Symbols | Oracle Definition of COBOL Symbols - Data Content |
---|---|
'B' |
blank (1 byte SBCS or 2 bytes DBCS depending on USAGE) |
'0' |
zero (1 byte SBCS) |
'/' |
forward slash (1 byte SBCS) |
'G' |
double byte |
Edited positions in COBOL statement data received from the remote host are converted by PGAU along with the entire field and passed to the client application in the corresponding PL/SQL VARCHAR2
output variable.
When editing symbols are present, they are interpreted to mean the remote host field contains the COBOL data content and length indicated. The editing positions are included in the length of the data field, but conversion of all field positions is processed by PGAU as a single string and no special scanning or translation is done for edited byte positions.
Edited positions in COBOL statement data sent to the remote host are converted by PGAU along with the entire PL/SQL VARCHAR2
input variable passed from the client application.
Table D-3 provides an example of how PGAU converts COBOL datatypes:
Table D-3 COBOL-PGAU Conversion
COBOL Datatype | Description of Conversion by PGAU |
---|---|
|
Is an alphanumeric field 7 bytes in length and would be converted in a single |
|
Is a DBCS field 12 bytes in length and would be converted in a single |
PGAU TIPs convert the COBOL The following are supported:
For
Refer to "NUMBER_TO_RAW and RAW_TO_NUMBER Argument Values" in Appendix C, "The UTL_PG Interface" for more information about numeric datatype conversions.
| |
COBOL If a |
Table D-4 describes format conversion:
Table D-4 Format Conversion Descriptions
Item | Description |
---|---|
This causes remote host transaction data to be converted as a PL/SQL
| |
This causes warnings to be issued during TIP generation. No alignment is performed. This is treated as documentation. The remote host transaction data is converted as a PL/SQL | |
This is an Oracle extension to the data definition as stored in the PG DD. This extension exists only in the PGAU context and is not valid COBOL syntax. The purpose of this extension is to provide a means for variable-length character data to be processed more efficiently by the TIP conversion logic. This is an alternative to defining a variable-length PIC X field as Note that the use of this construct does not affect the COBOL program. The The | |
This causes conversion of exactly ' | |
This causes conversion of at least ' Range conversion: PGAU-generated TIPs use a ' | |
A single PL/SQL variable declaration corresponds to a Lengths of renamed fields do not contribute to the overall parameter data length because the original fields dictate the lengths. | |
The ' The purpose of this extension is to provide a means for the gateway administrator or application developer to specify the criteria by which the redefinition is to be applied. For example, a record type field is often present in a record and different record formats apply depending on which record type is being processed. The specification of which type value applies to which redefinition is typically buried in the transaction programming logic, not in the data definition. To specify which conversion to perform on redefined formats in the TIP, the PGAU generates PL/SQL nested record declarations which correspond in name and datatype to the subordinate elements covered by the
This permits remote host copybooks to include definitions which | |
This causes the numeric field to be aligned on boundaries as dictated by the remote host environment, compiler language, and datatype. Numeric conversion is performed on the aligned data fields according to numeric datatype, as discussed in "PIC X Datatype Conversions", for both | |
This causes warnings to be issued during TIP generation and no realignment is performed. This is treated as documentation. Numeric conversion is performed on the aligned data fields according to numeric datatype, as discussed in "PIC X Datatype Conversions", for both |
When USAGE(ASIS)
is specified on the PGAU DEFINE DATA
statement, no conversion is performed. Consequently, each such field is simply copied to a PL/SQL RAW of the same byte length. No conversion, translation, or reformatting is done.
When USAGE(SKIP)
is specified on the PGAU DEFINE DATA
statement, no data exchange is performed. The data is skipped as if it did not exist. Consequently, such fields are not selected from the PG DD, not reflected in the TIP logic, and presumed absent from the data streams exchanged with the remote host. The purpose of "SKIP
" is to have definitions in the PG DD, but not active, perhaps because a remote host has either removed the field or has yet to include the field. SKIP
allows an existing data definition to be used even though some fields do not exist at the remote host.
COBOL special characters in record, group, and element names are translated when PGAU DEFINE
inserts definitions into the PG DD, and by PGAU GENERATE
when definitions are selected from the PG DD. Special characters are translated as follows:
hyphen is translated to underscore (_)
period is deleted
PL/SQL variable names are fully qualified and composed from:
PL/SQL record name as the leftmost qualifier corresponding to level 01 or 77 COBOL record name.
PL/SQL nested record names corresponding to COBOL group names.
PL/SQL nested fields corresponding to COBOL elements of datatype:
CHAR
or NUMBER
corresponding to non-repeating COBOL elements.
TABLE
corresponding to COBOL elements which fall within an OCCURS
or OCCURS DEPENDING ON
group (COBOL repeating fields correspond to PL/SQL nested RECORD
s of TABLE
's).
Note that when referencing PL/SQL variables from calling applications, the TIP package name must be prefixed as the leftmost qualifier. Thus the fully qualified reference to the PL/SQL variable which corresponds to:
SKILL
is:
tipname.EMPREC_Typ.SKILL(SKILL_Key)
HOME_ADDRESS
ZIP
is:
tipname.EMPREC_Typ.HOME_ADDRESS.ZIP.FIRST_FIVE tipname.EMPREC_Typ.HOME_ADDRESS.ZIP.LAST_FOUR
Truncated and Non-Unique Names
PGAU truncates field names and corresponding PL/SQL variable names when the name exceeds:
26 bytes for fields within an aggregate record or group
This is due to the need to suffix each field or PL/SQL variable name with:
"_Typ
" for group names
"_Tbl
" for element names with a repeating group
or
30 bytes due to the PL/SQL limitation of 30 bytes for any name
The rightmost four characters are truncated. This imposes the restriction that names be unique to 26
characters.
COBOL allows repetitive definition of the same group or element names within a record, and the context of the higher level groups serves to uniquely qualify names. However, because PGAU-generated TIPs declare PL/SQL record variables which reference nested PL/SQL records for subordinate groups and fields, such nested PL/SQL record types can have duplicate names.
Given the following COBOL definition, note that ZIP is uniquely qualified in COBOL, but the corresponding PL/SQL declaration would have a duplicate nested record type for ZIP.
01 EMPREC. 05 HIREDATE PIC X(8). 05 BIRTHDATE PIC X(8). 05 SKILL PIC X(12) OCCURS 4. 05 EMPNO PIC 9(4). 05 EMPNAME. 10 FIRST-NAME PIC X(10). 10 LAST-NAME PIC X(15). 05 HOME-ADDRESS. 10 STREET PIC X(20). 10 CITY PIC X(15). 10 STATE PIC XX. 10 ZIP. 15 FIRST-FIVE PIC X(5). 15 LAST-FOUR PIC X(4). 05 DEPT PIC X(45). 05 OFFICE-ADDRESS. 10 STREET PIC X(20). 10 CITY PIC X(15). 10 STATE PIC XX. 10 ZIP. 15 FIRST-FIVE PIC X(5). 15 LAST-FOUR PIC X(4). 05 JOBTITLE PIC X(20).
PGAU avoids declaring duplicate nested record types, and generates the following PL/SQL:
SKILL_Key BINARY_INTEGER; TYPE SKILL_Tbl is TABLE of CHAR(12) INDEX by BINARY_INTEGER; TYPE EMPNAME_Typ is RECORD ( FIRST_NAME CHAR(10), LAST_NAME CHAR(15)); TYPE ZIP_Typ is RECORD ( FIRST_FIVE CHAR(5), LAST_FOUR CHAR(4)); TYPE HOME_ADDRESS_Typ is RECORD ( STREET CHAR(20), CITY CHAR(15), STATE CHAR(2), ZIP ZIP_Typ); TYPE OFFICE_ADDRESS_Typ is RECORD ( STREET CHAR(20), CITY CHAR(15), STATE CHAR(2), ZIP ZIP_Typ); TYPE EMPREC_Typ is RECORD ( HIREDATE CHAR(8), BIRTHDATE CHAR(8), SKILL SKILL_Tbl, EMPNO NUMBER(4,0), EMPNAME EMPNAME_Typ, HOME_ADDRESS HOME_ADDRESS_Typ, DEPT CHAR(45), OFFICE_ADDRESS OFFICE_ADDRESS_Typ, JOBTITLE CHAR(20));
However, in the case where multiple nested groups have the same name but have different subfields (see ZIP
following):
05 HOME-ADDRESS. 10 STREET PIC X(20). 10 CITY PIC X(15). 10 STATE PIC XX. 10 ZIP. 15 LEFTMOST-FOUR PIC X(4). 15 RIGHMOST-FIVE PIC X(5). 05 DEPT PIC X(45). 05 OFFICE-ADDRESS. 10 STREET PIC X(20). 10 CITY PIC X(15). 10 STATE PIC XX. 10 ZIP. 15 FIRST-FIVE PIC X(5). 15 LAST-FOUR PIC X(4). 05 JOBTITLE PIC X(20).
PGAU alters the name of the PL/SQL nested record type for each declaration in which the subfields differ in name, datatype, or options. Note the "02
" appended to the second declaration (ZIP_Typ02
), and its reference in OFFICE_ADDRESS
.
TYPE EMPNAME_Typ is RECORD ( FIRST_NAME CHAR(10), LAST_NAME CHAR(15)); TYPE ZIP_Typ is RECORD ( LEFTMOST_FOUR CHAR(4), RIGHTMOST_FIVE CHAR(5)); TYPE HOME_ADDRESS_Typ is RECORD ( STREET CHAR(20), CITY CHAR(15), STATE CHAR(2), ZIP ZIP_Typ); TYPE ZIP_Typ02 is RECORD ( FIRST_FIVE CHAR(5), LAST_FOUR CHAR(4)); TYPE OFFICE_ADDRESS_Typ is RECORD ( STREET CHAR(20), CITY CHAR(15), STATE CHAR(2), ZIP ZIP_Typ02); TYPE EMPREC_Typ is RECORD ( HIREDATE CHAR(8), BIRTHDATE CHAR(8), SKILL SKILL_Tbl, EMPNO NUMBER(4,0), EMPNAME EMPNAME_Typ, HOME_ADDRESS HOME_ADDRESS_Typ, DEPT CHAR(45), OFFICE_ADDRESS OFFICE_ADDRESS_Typ, JOBTITLE CHAR(20));
And the fully qualified reference to the PL/SQL variable which corresponds to:
HOME_ADDRESS.ZIP
is:
tipname.EMPREC_Typ.HOME_ADDRESS.ZIP.LEFTMOST_FOUR tipname.EMPREC_Typ.HOME_ADDRESS.ZIP.RIGHTMOST_FIVE
OFFICE_ADDRESS.ZIP
is:
tipname.EMPREC_Typ.OFFICE_ADDRESS.ZIP.FIRST_FIVE tipname.EMPREC_Typ.OFFICE_ADDRESS.ZIP.LAST_FOUR
Note that the nested record type name ZIP_Typ02
is not used in the reference, but is implicit within PL/SQL's association of the nested records.
User's Guide
11g Release 2 (11.2)
E12071-02
September 2009
Oracle Database Gateway for APPC User's Guide, 11g Release 2 (11.2)
E12071-02
Copyright © 1996, 2009, Oracle and/or its affiliates. All rights reserved.
Primary Author: Maitreyee Chaliha
Contributor: Vira Goorah, Govind Lakkoju, Peter Wong, Juan Pablo Ahues-Vasquez, Peter Castro, and Charles Benet
This software and related documentation are provided under a license agreement containing restrictions on use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license, transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is prohibited.
The information contained herein is subject to change without notice and is not warranted to be error-free. If you find any errors, please report them to us in writing.
If this software or related documentation is delivered to the U.S. Government or anyone licensing it on behalf of the U.S. Government, the following notice is applicable:
U.S. GOVERNMENT RIGHTS Programs, software, databases, and related documentation and technical data delivered to U.S. Government customers are "commercial computer software" or "commercial technical data" pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As such, the use, duplication, disclosure, modification, and adaptation shall be subject to the restrictions and license terms set forth in the applicable Government contract, and, to the extent applicable by the terms of the Government contract, the additional rights set forth in FAR 52.227-19, Commercial Computer Software License (December 2007). Oracle USA, Inc., 500 Oracle Parkway, Redwood City, CA 94065.
This software is developed for general use in a variety of information management applications. It is not developed or intended for use in any inherently dangerous applications, including applications which may create a risk of personal injury. If you use this software in dangerous applications, then you shall be responsible to take all appropriate fail-safe, backup, redundancy, and other measures to ensure the safe use of this software. Oracle Corporation and its affiliates disclaim any liability for any damages caused by use of this software in dangerous applications.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.
This software and documentation may provide access to or information on content, products, and services from third parties. Oracle Corporation and its affiliates are not responsible for and expressly disclaim all warranties of any kind with respect to third-party content, products, and services. Oracle Corporation and its affiliates will not be responsible for any loss, costs, or damages incurred due to your access to or use of third-party content, products, or services.
The Oracle Database Gateway for APPC enables users to initiate transaction program execution on remote online transaction processors (OLTPs). The Oracle Database Gateway for APPC can establish connection with OLTP using the SNA communication protocol. The gateway can also use TCP/IP for IMS Connect to establish communication with IMS/TM through TCP/IP. The gateway provides Oracle applications with seamless access to IBM mainframe data and services through Remote Procedural Call (RPC) processing.
Refer to the Oracle Database Installation Guide and to the certification matrix on the My Oracle Support Web site for the most up-to-date list of certified hardware platforms and operating system versions. The My Oracle Support Web site can be found at:
This chapter describes the architecture, uses, and features of the Oracle Database Gateway for APPC.
This chapter contains the following sections:
The Oracle Database Gateway for APPC extends the RPC facilities available with the Oracle database. The gateway enables any client application to use PL/SQL to request execution of a remote transaction program (RTP) residing on a host. The gateway provides RPC processing to systems using the SNA Advanced Program-to-Program Communication (APPC) protocol and to IMS/TM systems using TCP/IP support for IMS Connect. This architecture allows efficient access to data and transactions available on the IBM mainframe and IMS, respectively.
The gateway requires no Oracle software on the remote host system. Thus, the gateway uses existing transactions with little or no programming effort on the remote host.
For gateways using SNA only:
The use of a generic and standard protocol, APPC, allows the gateway to access numerous systems. The gateway can communicate with virtually any APPC-enabled system, including IBM Corporation's CICS on any platform and IBM Corporation's IMS and APPC/MVS. These transaction monitors provide access to a broad range of systems, allowing the gateway to access many datastores, including VSAM, DB2 (static SQL), IMS, and others.
The gateway can access any application capable of using the CPI-C API, either directly or through a TP monitor such as CICS.
The Oracle Database Gateway for APPC provides the following benefits:
The gateway is optimized so that remote execution of a program is achieved with minimum network traffic. The interface to the gateway is an optimized PL/SQL stored procedure specification (called the TIP or transaction interface package) precompiled in the Oracle database. Because there are no additional software layers on the remote host, overhead occurs only when your program executes.
Client applications need not be operating system-specific. For example, your application can call a program in a CICS Transaction Server for z/OS. If you move the program to a CICS region on AIX, then you need not change the application.
Users calling applications that execute a remote transaction program are unaware that a request is sent to a host.
You can use the gateway to interface with existing procedural logic or to integrate new procedural logic into an Oracle database environment.
The integration of the Oracle database with the gateway enables the gateway to benefit from existing and future Oracle database features. For example, the gateway can be called from an Oracle stored procedure or database trigger.
Transactional support
The gateway and the Oracle database allow remote transfer updates and Oracle database updates to be performed in a coordinated fashion.
The gateway supports any tool or application that supports PL/SQL.
The Oracle Database Gateway for APPC provides a powerful development environment, including:
a data dictionary to store information relevant to the remote transaction
a tool to generate the PL/SQL Transaction Interface Package, or TIP
a report utility to view the information stored in the gateway dictionary
a complete set of tracing and debugging facilities
a wide set of samples to demonstrate the use of the product against datastores such as DB2, IMS, and CICS.
The gateway provides site autonomy, allowing you to do such things as authenticate users. It also provides role-based security compatible with any security package running on your mainframe computer.
Globalization Support
TCP/IP support for IMS Connect
This release of the gateway includes TCP/IP support for IMS Connect, giving users a choice of whether to use an SNA or TCP/IP communication protocol. IMS Connect is an IBM product which allows TCP/IP clients to trigger execution of IMS transactions. The gateway can use a TCP/IP communication protocol to access IMS Connect, which triggers execution of IMS transactions. There is no SNA involvement with this configuration.
Related to this feature of the gateway is:
The following terms and definitions are used throughout this guide:
This file is known as initsid.ora
and it contains parameters that govern the operation of the gateway. If you are using the SNA protocol, refer to Appendix A, "Gateway Initialization Parameters for SNA Protocol" in the Oracle Database Gateway for APPC Installation and Configuration Guide for AIX 5L Based Systems (64-Bit), HP-UX Itanium, Solaris Operating System (SPARC 64-Bit), Linux x86, and Linux x86-64 or Oracle Database Gateway for APPC Installation and Configuration Guide for Microsoft Windows for more information. If your protocol is TCP/IP, refer to Appendix B, "Gateway Initialization Parameters for TCP/IP Communication Protocol" in the Oracle Database Gateway for APPC Installation and Configuration Guide for AIX 5L Based Systems (64-Bit), HP-UX Itanium, Solaris Operating System (SPARC 64-Bit), Linux x86, and Linux x86-64 or Oracle Database Gateway for APPC Installation and Configuration Guide for Microsoft Windows.
The Oracle Database Gateway for APPC provides prebuilt remote procedures. In general, the following three remote procedures are used:
PGAINIT
, which initializes transactions
PGAXFER
, which transfers data
PGATERM
, which terminates transactions
Refer to Appendix B, "Gateway RPC Interface" in this guide and to "Remote Procedural Call Functions" in Chapter 1 of the Oracle Database Gateway for APPC Installation and Configuration Guide for AIX 5L Based Systems (64-Bit), HP-UX Itanium, Solaris Operating System (SPARC 64-Bit), Linux x86, and Linux x86-64 or Oracle Database Gateway for APPC Installation and Configuration Guide for Microsoft Windows for more information about gateway remote procedures.
dg4pwd
is a utility which encrypts passwords that are normally stored in the gateway initialization file. Passwords are stored in an encrypted form in the password file, making the information more secure. Refer to "Passwords in the Gateway Initialization File" in the security requirements chapter of the Oracle Database Gateway for APPC Installation and Configuration Guide for AIX 5L Based Systems (64-Bit), HP-UX Itanium, Solaris Operating System (SPARC 64-Bit), Linux x86, and Linux x86-64 and Oracle Database Gateway for APPC Installation and Configuration Guide for Microsoft Windows for detailed information about how the dg4pwd
utility works.
This tool is applicable only when the gateway is using TCP/IP support for IMS Connect. Its function is to map SNA parameters (such as Side Profile Name) to TCP/IP parameters (such as OLTP host name, IMS Connect port number and IMS destination ID).
PGA (Procedural Gateway Administration)
PGA is a general reference within this guide to all or most components comprising the Oracle Database Gateway for APPC. This term is used when references to a specific product or component are too narrow.
PGDL (Procedural Gateway Definition Language)
PGDL is the collection of statements used to define transactions and data to the PGAU.
PL/SQL Stored Procedure Specification (PL/SQL package)
This is a precompiled PL/SQL procedure that is stored in Oracle database.
UTL_RAW PL/SQL Package (the UTL_RAW Functions)
This component of the gateway represents a series of data conversion functions for PL/SQL RAW variables and remote host data. The types of conversions performed depend on the language of the remote host data. Refer to Appendix D, "Datatype Conversions" in this guide for more information.
UTL_PG PL/SQL Package (the UTL_PG Functions)
This component of the gateway represents a series of COBOL numeric data conversion functions. Refer to "NUMBER_TO_RAW and RAW_TO_NUMBER Argument Values" in Appendix C of this guide for supported numeric datatype conversions.
This is any Oracle database instance that communicates with the gateway for purposes of performing RPCs to execute RTP. The Oracle database can be on the same system as the gateway or on a different system. If it is on a different system, then Oracle Net is required on both systems. Refer to Figure 1-2, "Gateway Architecture Featuring SNA or TCP/IP Protocol" for a view of the gateway architecture.
OLTP (Online Transaction Processor)
OLTP is any of a number of online transaction processors available from other vendors, including CICS Transaction Server for z/OS and IMS/TM.
PGAU (Procedural Gateway Administration Utility)
PGAU is the tool that is used to define and generate PL/SQL transaction interface packages (TIPs). Refer to Chapter 2, "Procedural Gateway Administration Utility" in this guide for more information about PGAU.
PG DD (Procedural Gateway Data Dictionary)
This component of the gateway is a repository of remote host transaction definitions and data definitions. PGAU accesses definitions in the PG DD when generating TIPs. The PG DD has datatype dependencies because it supports the PGAU and is not intended to be directly accessed by the customer. Refer to Appendix A, "Database Gateway for APPC Data Dictionary" in this guide for a list of PG DD tables.
RPC is a programming call that executes program logic on one system in response to a request from another system. Refer to "Gateway Remote Procedure" in Appendix C of the Oracle Database Gateway for APPC Installation and Configuration Guide for AIX 5L Based Systems (64-Bit), HP-UX Itanium, Solaris Operating System (SPARC 64-Bit), Linux x86, and Linux x86-64or Oracle Database Gateway for APPC Installation and Configuration Guide for Microsoft Windows , and to Appendix B, "Gateway RPC Interface" in this guide for more information.
RTP (Remote Transaction Program)
A remote transaction program is a customer-written transaction, running under the control of an OLTP, which the user invokes remotely using a PL/SQL procedure. To execute a remote transaction program through the gateway, you must use RPC to execute a PL/SQL program to call the gateway functions.
TIP (Transaction Interface Package)
A TIP is an Oracle PL/SQL package that exists between your application and the remote transaction program. The transaction interface package, or TIP, is a set of PL/SQL stored procedures that invoke the RTP through the gateway. TIPs perform the conversion and reformatting of remote host data using PL/SQL and UTL_RAW/UTL_PG
functions.
Figure 1-1 illustrates where the terminology discussed in the preceding sections applies to the gateway's architecture.
Figure 1-1 Relationship of Gateway and Oracle Database
The following sample files and examples are referred to for illustration purposes throughout this guide. There are different example and sample files for a gateway using the SNA protocol than for a gateway using TCP/IP for IMS Connect.
Examples and Sample Files for Gateway Using SNA
For gateways using the SNA communication protocol, this guide uses a CICS-DB2 inquiry as an example. Transaction Interface Packages (TIPs) pgadb2i.pkb
and pgadb2i.pkh
send an employee number, empno
, to a DB2 application and receive an employee record, emprec
.
The CICS-DB2 inquiry sample and its associated PGAU commands are also available in the %ORACLE_HOME%\dg4appc\demo\CICS
directory on Windows platform and $ORACLE_HOME/dg4appc/demo/CICS
directory on UNIX platforms. The sample CICS-DB2 inquiry used as an example in this chapter is in files pgadb2i.pkh
and pgadb2i.pkb
. Refer to the README.doc
file in the same directory for information about installing and using the samples. It can be found in the %ORACLE_HOME%\dg4appc\demo\CICS
directory for Windows and $ORACLE_HOME/dg4appc/demo/CICS
directory for UNIX.
Examples and Sample Files for Gateway Using TCP/IP
If your gateway is using the TCP/IP communication protocol, this guide uses an IMS inquiry as an example. Transaction Interface Packages (TIPs) pgtflip.pkh
and pgtflip.pkb
send input to IMS, through IMS Connect, and receive the flipped input as the output.
The IMS inquiry sample (FLIP) and its associated PGAU commands are located in the %ORACLE_HOME%\dg4appc\demo\IMS
directory for Windows and $ORACLE_HOME/dg4appc/demo/IMS
directory for UNIX. The sample IMS inquiry used as an example for a gateway using TCP/IP is located in files pgtflip.pkh
and pgtflip.pkb
.
Refer to the README.doc
file for more information about installing and using other IMS samples. It can be found in the %ORACLE_HOME%\dg4appc\demo\IMS
directory for Windows and $ORACLE_HOME/dg4appc/demo/IMS
directory for UNIX.
The architecture of Oracle Database Gateway for APPC consists of several components:
Refer to the configuration chapter corresponding to your communications protocol in the Oracle Database Gateway for APPC Installation and Configuration Guide for AIX 5L Based Systems (64-Bit), HP-UX Itanium, Solaris Operating System (SPARC 64-Bit), Linux x86, and Linux x86-64 or Oracle Database Gateway for APPC Installation and Configuration Guide for Microsoft Windowsfor a description of the various methods for establishing the gateway-Oracle database relationship.
The Oracle database can also be used for non-gateway applications.
The gateway
Oracle Database Gateway for APPC must be installed on a server that can run the required version of the operating system.
An OLTP
The OLTP must be accessible from the gateway using your SNA or TCP/IP communication protocol. Multiple Oracle databases can access the same gateway. A single system gateway installation can be configured to access more than one OLTP.
For gateways using TCP/IP: The only OLTP that is supported through TCP/IP is IMS through IMS Connect.The OLTP must be accessible to the system using the TCP/IP protocol. Multiple Oracle databases can access the same gateway. A single system gateway installation can be configured to access more than one OLTP. Multiple IMS systems can be accessed from an IMS Connect. If you have a number of IMS Connect systems available, any of these may be connected to one or more IMS systems.
Figure 1-2 illustrates the architecture of the Oracle Database Gateway for APPC using SNA or TCP/IP, as described in the previous section.
Figure 1-2 Gateway Architecture Featuring SNA or TCP/IP Protocol
All the communication between the user or client program and the gateway is handled through a TIP which executes on an Oracle database. The TIP is a standard PL/SQL package that provides the following functions:
declares the PL/SQL variables that can be exchanged with a remote transaction program;
calls the gateway packages that handle the communications for starting the conversation, exchanging data, and terminating the conversation;
handles all datatype conversions between PL/SQL datatypes and the target program datatypes.
The PGAU, provided with the gateway, automatically generates the TIP specification.
The gateway is identified to the Oracle database using a database link. The database link is the same construct used to identify other Oracle databases. The functions in the gateway are referenced in PL/SQL as:
function_name@dblink_name
The Oracle Database Gateway for APPC provides a set of functions that are called by the client through RPC. These functions direct the gateway to initiate, transfer data with, and terminate RTP running under an OLTP on another system.
Table 1-1 lists the RPC functions and the correlating commands that are invoked in the gateway and remote host.
Table 1-1 RPC Functions and Commands in the Gateway and Remote Host
Applications | Oracle TIP | Gateway | Remote Host |
---|---|---|---|
|
|
|
Initiate program |
|
|
|
Exchange data |
|
|
|
Terminate program |
The following sections describe how a TIP works by first establishing a connection to the remote host, then exchanging data from the target transaction program and finally, terminating a conversation.
The TIP initiates a connection to the remote host using one of the gateway functions, PGAINIT
.
When the communication protocol is SNA: PGAINIT
provides, as input, the required SNA parameters to start a conversation with the target transaction program. These parameters are sent across the SNA network, which returns a conversation identifier to PGAINIT
. Future calls to the target program use the conversation identifier as an input parameter.
When the communication protocol is TCP/IP: PGAINIT
provides, as input, the required TCP/IP parameters.These parameters are sent across the TCP/IP network to start the conversation with the target transaction program. The TCP/IP network returns a socket file descriptor to PGAINIT
. Future calls, such as PGAXFER
and PGATERM
, use this same socket file descriptor as an input parameter.
After the conversation is established, a database gateway function called PGAXFER
can exchange data in the form of input and output variables. PGAXFER
sends and receives buffers to and from the target transaction program. The gateway sees a buffer as only a RAW stream of bytes. The TIP that resides in the Oracle database is responsible for converting PL/SQL datatypes of the application to RAW before sending the buffer to the gateway. It is also responsible for converting RAW to PL/SQL datatypes before returning the results to the application.
When communication with the remote program is complete, the gateway function PGATERM
terminates the conversation between the gateway and the remote host.
When the communication protocol is SNA: PGATERM
uses the conversation identifier as an input parameter to request conversation termination.
When the communication protocol is TCP/IP: PGATERM
uses the socket file descriptor for TCP/IP as an input parameter to request conversation termination.
Note: At this point, if your communication protocol is SNA, then proceed to the following section, Section 1.8, "Overview of a Gateway Using SNA".If your gateway communication protocol is TCP/IP, then proceed to Section 1.9, "Overview of a Gateway Using TCP/IP". |
If you are using the SNA communication protocol, read the following sections to develop an understanding of how the gateway communicates with the Oracle database and with the mainframe, as well as transaction types unique to your gateway and writing TIPs.
The Oracle Database Gateway for APPC supports three types of transactions that read data from and write data to remote host systems:
one-shot
In a one-shot transaction, the application starts the connection, exchanges data, and terminates the connection, all in a single call.
persistent
In a persistent transaction, multiple calls to exchange data with the remote transaction can be executed before terminating the conversation.
multi-conversational
In a multi-conversational transaction, the database gateway server can be used to exchange multiple records in one call to the remote transaction program.
Refer to "Remote Host Transaction Types" in Chapter 4, "Client Application Development (SNA Only)" of this guide for more information about transaction types.
The following list demonstrates examples of the power of the Oracle Database Gateway for APPC:
You can initiate a CICS transaction on the mainframe to retrieve data from a VSAM file for a PC application.
You can modify and monitor the operation of a remote process control computer.
You can initiate an IMS/TM transaction that executes static SQL in DB2.
You can initiate a CICS transaction that returns a large number of records in a single call.
This section describes simple communication between the mainframe and the Oracle database on a gateway using the SNA communication protocol. The Oracle Database Gateway for APPC lets you write your own procedures to begin transferring information between the Oracle database and a variety of programs on an IBM mainframe, including IBM CICS, IMS, and APPC/MVS.
For an illustration of the communications function of the Oracle Database Gateway for APPC, refer to %ORACLE_HOME%\dg4appc\demo\CICS\pgacics.sql
on Microsoft Windows or $ORACLE_HOME/dg4appc/demo/CICS/pgacics.sql
on UNIX based platforms. This is a sample communication between the Oracle database and CICS Transaction Server for z/OS. Executing this simple PL/SQL procedure pgacics.sql
, causes the Oracle database to invoke the database gateway, which uses SNA to converse with the FLIP
transaction in CICS. These steps are described in detail in Section 1.8.2.1, "Steps to Communicate Between Gateway and Mainframe Using SNA". Note that you will already have compiled and linked the stored procedure when you configured the gateway.
The following steps describe the Windows-to-mainframe communications process illustrated in Figure 1-3, "Communication Between the Oracle Database and the Mainframe, Using SNA" when your communication protocol is SNA to communicate between the gateway and the mainframe:
From SQL*Plus, execute pgacics
. This invokes the PL/SQL stored procedure in the Oracle database.
For Microsoft Windows:
C:\> sqlplus <userid>/<password>@<database_specification_string> SQL> execute pgacics('==< .SCIC htiw gnitacinummoc si yawetag ruoy ,snoitalutargnoC >==');
For UNIX Based platforms:
$ sqlplus <userid>/<password>@<database_specification_string> SQL> execute pgacics('==< .SCIC htiw gnitacinummoc si yawetag ruoy ,snoitalutargnoC >==');
The pgacics
PL/SQL stored procedure will start up the gateway. The gateway will start up communication with CICS Transaction Server for z/OS through SNA and will call FLIP
.
FLIP
processes the input, generates the output and sends the output back to the database gateway.
Finally, the database gateway will send the output back to the PL/SQL stored procedure in the Oracle database. The result is displayed in SQL*Plus:
==> Congratulations, your gateway is communicating with CICS. <== PL/SQL procedure successfully completed.
Figure 1-3, "Communication Between the Oracle Database and the Mainframe, Using SNA" illustrates the communications process described in steps 0 through 4.
Figure 1-3 Communication Between the Oracle Database and the Mainframe, Using SNA
Most transactions using SNA communication protocol are much larger and more complex than the sample pgacics.sql
file referred to in Figure 1-3, "Communication Between the Oracle Database and the Mainframe, Using SNA". Additionally, communication with a normal-sized RTP would require you to create an extremely long PL/SQL file. PGAU function generates the PL/SQL procedure for you.
The following is a brief description of the four steps necessary for you to generate a TIP. Refer to Chapter 3, "Creating a TIP" for detailed information about this procedure, and refer to Chapter 2, "Procedural Gateway Administration Utility" for more information about PGAU.
All parameter names in this section are taken from a file called pgadb2i.ctl
in the %ORACLE_HOME%\pga4appc\demo\CICS
directory on Microsoft Windows or in the $ORACLE_HOME/pga4appc/demo/CICS
directory on UNIX Based systems.
Follow these steps to write a TIP.
The user writes the control files. The control file has four main types of PGAU commands:
DEFINE DATA
. This is used to define input and output fields, using COBOL data definitions.
Sample define data:
define data empno plsdname(empno) usage(pass) language(ibmvscobolii) infile("empno.cob");
DEFINE CALL
. This is used to define PL/SQL functions calls to be generated as part of the package.
Sample define call:
define call db2imain pkgcall(pgadb2i_main) parms((empno in),(emprec out));
DEFINE TRANSACTION
. This is used to group the preceding functions and specify other parameters on which the TIP depends.
Sample define transaction:
define transaction db2i call(db2imain,db2idiag) sideprofile(CICSPGA) tpname(DB2I) logmode(oraplu62) synclevel(0) nls_language("american_america.we8ebcdic37c");
GENERATE
. This is used to generate the TIP specification files from the previously stored data, call, and transaction definitions.
Sample generate transaction:
generate db2i pkgname(pgadb2i) pganode(pga) outfile("pgadb2i");
Running the control file within PGAU will create PG DD entries for the data, call, and transaction definitions, and will generate the specification files (For example, pgadb2i.pkh
and pgadb2i.pkb
):
For Microsoft Windows:
C:\> pgau PGAU> CONNECT<userid>/<password>@<database>_specification_string> PGAU> @pgadb2i.ctl
For UNIX based systems:
$ pgau PGAU> CONNECT<userid>/<password>@<database>_specification_string> PGAU> @pgadb2i.ctl
Running the specification files will create the PL/SQL stored procedures. Note that the header specification file (for example, pgadb2i.pkh
) must be run first:
For Microsoft Windows:
C:\> sqlplus<userid>/<password>@<database_specification_string> SQL> @pgadb2i.pkh; SQL> @pgadb2i.pkb;
For UNIX based systems:
$ sqlplus<userid>/<password>@<database_specification_string> SQL> @pgadb2i.pkh; SQL> @pgadb2i.pkb;
The TIP is now ready for use. For convenience, it will usually be called using a driver procedure (for example, db2idriv
). This driver will then call the individual stored procedures in the correct order. Create the driver procedure and run it:
For Microsoft Windows:
C:\> sqlplus <userid>/<password>@<database_specification string> SQL> @pgadb2id.sql SQL> execute db2idriv('000320');
For UNIX based systems:
$ sqlplus <userid>/<password>@<database_specification string> SQL> @pgadb2id.sql SQL> execute db2idriv('000320');
If you are using the TCP/IP communication protocol, read the following sections to develop an understanding of how the gateway communicates with the Oracle database and with the mainframe, as well as transaction types unique to your gateway and writing TIPs.
The Oracle Database Gateway for APPC using TCP/IP support for IMS Connect supports three types of transaction socket connections:
The socket connection lasts across a single transaction.
The socket connection lasts across multiple transactions.
The socket connection lasts across a single exchange consisting of one input and one output.
Note: Do not use the nonpersistent socket type if you plan to implement conversational transactions because multiple connections and disconnections will occur. |
Refer to the section about pg4tcpmap
commands in Chapter 6, "PG4TCPMAP Commands (TCP/IP Only)" of this guide for more information about the function and use of these parameters.
You can initiate an IMS/TM transaction that executes static SQL in DB2. This illustrates the power of the Oracle Database Gateway for APPC's feature supporting TCP/IP for IMS Connect.
This section describes simple communication between IMS and the Oracle database whenTCP/IP for IMS Connect is being used as the communication protocol between the gateway and the remote host (IMS). The Oracle Database Gateway for APPC lets you write your own procedures to begin transferring information between the Oracle database and I/O PCB programs on IMS.
For an illustration of the communications function of the gateway using TCP/IP for IMS Connect, refer to the %ORACLE_HOME%\dg4appc\demo\IMS\pgaims.sql
file on Microsoft Windows or $ORACLE_HOME/dg4appc/demo/IMS/pgaims.sql
on UNIX based systems.
Executing the simple PL/SQL procedure pgaims.sql
causes the Oracle database to call the gateway, which uses TCP/IP to converse with the sample transaction FLIP
in IMS. The communication steps that take place when you execute the PL/SQL procedure are described in detail in Section 1.9.2.2, "Steps to Communication Between the Gateway and IMS, Using TCP/IP". Note that you will already have compiled and linked the stored procedure when you configured the gateway.
If your gateway is using TCP/IP support for IMS Connect, then you must use the pg4tcpmap
tool to create the required mapping between PGAINIT
parameters and the target system network address information. The pg4tcpmap
tool maps the Side Profile Name specified in a DEFINE TRANSACTION
to TCP/IP and IMS Connect attributes, such as port number, IP address (host name) and IMS subsystem ID. The TCP/IP parameters are used to start a conversation with the target transaction program.
The pg4tcpmap
tool must be run in order to populate the PGA_TCP_IMSC
table before executing any TIPs which rely on TPC/IP support for IMS Connect.
Refer to Chapter 6, "PG4TCPMAP Commands (TCP/IP Only)" in this guide for complete instructions for setting up and executing pg4tcpmap
commands to populate the PGA_TCP_IMSC
table. Chapter 6 also explains the content of the PGA_TCP_IMSC
table and an example of how to use the table.
A trace file from a sample pg4tcpmap
execution is located in Chapter 8, "Troubleshooting" in this guide.
A screen output file is located in Appendix B, "Gateway Initialization Parameters for TCP/IP Communication Protocol" in the Oracle Database Gateway for APPC Installation and Configuration Guide for AIX 5L Based Systems (64-Bit), HP-UX Itanium, Solaris Operating System (SPARC 64-Bit), Linux x86, and Linux x86-64 or Oracle Database Gateway for APPC Installation and Configuration Guide for Microsoft Windows.
The following steps describe the communications process, as illustrated in Figure 1-4 when your communication protocol is TCP/IP:
From SQL*Plus, execute pgaims.sql
. This invokes the PL/SQL stored procedure in the Oracle database.
For Microsoft Windows:
C:\> sqlplus <userid>/<password>@<database_specification_string> SQL> execute pgaims 'snoitalutargnoC';
For UNIX based systems:
$ sqlplus <userid>/<password>@<database_specification_string> SQL> execute pgaims 'snoitalutargnoC';
The pgaims.sql
stored procedure will start up the gateway.
The gateway which has the APPC information will call the mapping table (PGA_TCP_IMSC
). The mapping table will map the information so that it will have the host name (TCP/IP address) and the port number.
When the gateway has the port number and host name, it will initiate communication with IMS Connect through TCP/IP, and it will call FLIP
through IMS.
FLIP
processes the input, generates the output, and sends the output back to the gateway.
Finally, the gateway will send the output back to the PL/SQL stored procedure in the Oracle database. The result is displayed in SQL*Plus:
Congratulations PL/SQL procedure successfully completed.
Figure 1-4, "Communication Between Oracle Database and Mainframe, Using TCP/IP" illustrates the communications process described in the previous Steps 0 through 5.
Figure 1-4 Communication Between Oracle Database and Mainframe, Using TCP/IP
Most transactions are much larger and more complex than the sample pgaims.sql
file referred to in Figure 1-4, "Communication Between Oracle Database and Mainframe, Using TCP/IP". Additionally, communication with a normal-sized RTP (remote transaction program) would require you to create an extremely long PL/SQL file. Oracle Database Gateway for APPC's TIP function generates the PL/SQL procedure for you.
The following is a brief description of the four steps necessary for you to generate a TIP. Refer to Chapter 3, "Creating a TIP" for detailed information about this procedure, and refer to Chapter 2, "Procedural Gateway Administration Utility" for more information about PGAU.
All parameter names in this section are taken from a file called pgtflip.ctl
in the %ORACLE_HOME%\pga4appc\demo\IMS
directory on Microsoft Windows or $ORACLE_HOME/pga4appc/demo/IMS
directory on UNIX based systems.
Follow these steps to write a TIP.
The user writes the control files. The control file has four main types of PGAU commands:
DEFINE DATA
. This is used to define input and output fields, using COBOL data definitions.
Sample define data:
define data flipin plsdname(flipin) usage(pass) language(ibmvscobolii) ( 01 msgin pic x(20). ) define data flipout plsdname(flipout) usage(pass) language(ibmvscobolii) ( 01 msgout pic x(20). )
DEFINE CALL
. This is used to define PL/SQL functions calls to be generated as part of the package.
Sample define call:
define call flipmain pkgcall(pgtflip_main) parms((flipin in),(flipout out));
DEFINE TRANSACTION
. This is used to group the preceding functions and specify other parameters on which the TIP depends.
Sample define transaction:
define transaction imsflip call(flipmain) sideprofile(pgatcp) tpname(flip) nls_language("american_america.us7ascii");
Note: On a gateway using TCP/IP, the side profile name value is actually the TCP/IP unique name that was defined when the user specified the value, host name, port number and many other IMS Connect values during configuration of the network. |
GENERATE
. This is used to generate the TIP specification files from the previously stored data, call, and transaction definitions.
Sample generate transaction:
generate imsflip pkgname(pgtflip) pganode(pga10ia) outfile("pgtflip") diagnose(pkgex(dc,dr));
Running the control file within PGAU will create PG DD entries for the data, call, and transaction definitions and will generate the specification files (for example, pgtflip.pkh
and pgtflip.pkb
):
For Microsoft Windows:
C:\> cd %ORACLE_HOME%\dg4appc\demo\IMS C:\> pgau PGAU> CONNECT userid/password@database_specification_string PGAU> @pgtflip.ctl
For UNIX based systems:
$ pgau PGAU> CONNECT userid/password@database_specification_string PGAU> @pgtflip.ctl
Running the specification files will create the PL/SQL stored procedures. Note that the header specification file (for example, pgtflip.pkh
) must be run first:
For Microsoft Windows:
C:\> sqlplus userid/password@database_specification_string SQL> @pgtflip.pkh; SQL> @pgtflip.pkb;
For UNIX based systems:
$ sqlplus userid/password@database_specification_string SQL> @pgtflip.pkh; SQL> @pgtflip.pkb;
The TIP is now ready for use. For convenience, it will usually be called using a driver procedure (for example, pgtflipd
). This driver will then call the individual stored procedures in the correct order. Create the driver procedure and run it:
For Microsoft Windows:
C:\> sqlplus <userid>/<password>@<database_specification string> SQL> @pgtflip.sql SQL> execute pgtflipd('hello');
For UNIX based system:
$ sqlplus <userid>/<password>@<database_specification string> SQL> @pgtflip.sql SQL> execute pgtflipd('hello');
This chapter discusses how you will call a TIP and control a remote host transaction. It also provides you with the steps for preparing and executing a gateway transaction. This chapter assumes:
a remote host transaction (RHT) has already been written;
a TIP corresponding to the RHT has already been defined using the steps described in Chapter 3, "Creating a TIP".
Note: If your gateway uses the TCP/IP support for IMS Connect, refer to Chapter 7, "Client Application Development (TCP/IP Only)" for information about calling a TIP and controlling a remote host transaction. |
This chapter contains the following sections:
"Ensuring TIP and Remote Transaction Program Correspondence"
"Application Development with Multi-Byte Character Set Support"
The Procedural Gateway Administration Utility (PGAU) generates a complete TIP using definitions you provide. The client application can then call the TIP to access the remote host transaction. Chapter 2, "Procedural Gateway Administration Utility", discusses the use of PGAU in detail.
This overview explains what you must do in order to call a TIP and control a remote host transaction.
The gateway receives PL/SQL calls from the Oracle database and issues APPC calls to communicate with a remote transaction program. The following three application programs make this possible:
an APPC-enabled remote host transaction program
a Transaction Interface Package, or TIP. A TIP is a PL/SQL package that handles communication between the client and the gateway and performs datatype conversions between COBOL and PL/SQL.
PGAU generates the TIP specification for you. In the shipped samples, the PGAU-generated package is called pgadb2i.pkb
. This generated TIP includes at least three function calls that map to the remote transaction program:
pgadb2i_init
initializes the conversation with the remote transaction program
pgadb2i_main
exchanges application data with the remote transaction program
pgadb2i_term
terminates the conversation with the remote transaction program
Refer to Appendix E, "Tip Internals" for more information about TIPs, if you are writing your own TIP or debugging.
a client application that calls the TIP.
The client application calls the three TIP functions with input and output arguments. In the example, the client application passes empno
, an employee number to the remote transaction and the remote transaction sends back emprec
an employee record.
Table 4-1 demonstrates the logic flow between the PL/SQL driver, the TIP, and the gateway using the example CICS-DB2 transaction.
Table 4-1 Logic Flow of CICS-DB2 Example
Client Application | Oracle TIP | Procedures Established Between the Gateway and the Remote Transaction (mainframe) |
---|---|---|
|
Calls |
Gateway sets up control blocks and issues APPC |
|
Calls |
Gateway issues APPC |
|
Call |
Gateway cleans up control blocks. |
A client application which utilizes the gateway to exchange data with a remote host transaction performs some tasks for itself and instructs the TIP to perform other tasks on its behalf. The client application designer must consequently know the behavior of the remote transaction and how the TIP facilitates the exchange.
The following sections provide an overview of remote host transaction behavior, how this behavior is controlled by the client application and how TIP function calls and data declarations support the client application to control the remote host transaction. These sections also provide background information about what the TIP does for the client application and how the TIP calls exchange data with the remote host transaction.
To prepare the client application for execution you must understand the remote host transaction requirements and then perform these steps:
Move relevant COBOL records layout (copybooks) to the gateway system for input to PGAU.
Describe the remote host transaction data and calls to the PG Data Dictionary (PG DD) with DEFINE DATA
, DEFINE CALL
, and DEFINE TRANSACTION
statements.
Generate the TIP in the Oracle database, using GENERATE
.
Create the client application that calls the TIP public functions.
Grant privileges on the newly created package.
Browse through the remote host transaction program (RTP) to determine:
the PL/SQL parameters required on the various client application to TIP calls
the order in which the calls are made
Identify the remote host transaction program (RTP) facilities to be called and the data to be exchanged on each call. You will then define the following, and store them in the PG DD:
DEFINE DATA
DEFINE CALL
DEFINE TRANSACTION
Refer to Chapter 3, "Creating a TIP" for specific definition steps and for the actual creation and generation of a TIP.
The content of a PGAU-generated TIP reflects the calls available to the remote host transaction and the data that has been exchanged. Understanding this content helps when designing and debugging client applications that call the TIP.
A TIP is a PL/SQL package, and accordingly has two sections:
A Package Specification containing:
Public function prototypes and parameters, and
A Package Body containing:
Private functions and internal control variables
Public functions
Package initialization following the last public function.
The purpose of the TIP is to provide a PL/SQL callable public function for every allowed remote transaction program interaction. A remote transaction program interaction is a logically related group of data exchanges through one or more PGAXFER
RPC calls. This is conceptually similar to a screen or menu interaction in which several fields are filled in, the enter key is pressed, and several fields are returned to the user. Carrying the analogy further:
the user might be likened to the TIP or client application
fields to be filled in are IN
parameters on the TIP function call
fields returned are OUT
parameters on the TIP function call
screen or menu is the group of IN
and OUT
parameters combined
a pressed enter key is likened to the PGAXFER
remote procedural call (RPC)
The actual grouping of parameters that constitute a transaction call is defined by the user. The gateway places no restrictions on how a remote transaction program might correspond to a collection of TIP function calls, each call having many IN
and OUT
parameters.
PGA users typically have one TIP per remote transaction program. How the TIP function calls are grouped and what data parameters are exchanged on each call depends on the size, complexity and behavior of the remote transaction program.
Refer to Oracle's Oracle Database PL/SQL Language Reference for a discussion of how PL/SQL packages work. The following discussion covers the logic that must be performed within a TIP. Refer to the sample TIP and driver supplied in the %ORACLE_HOME%\dg4appc\demo\CICS
directory for Microsoft Windows or $ORACLE_HOME/dg4appc/demo/CICS
directory for UNIX based systems, in files pgadb2i.pkh
, pgadb2i.pkb
, and pgadb2id.sql
.
From a database gateway application perspective, there are three main types of remote host transactions:
one-shot
persistent
multi-conversational
A simple remote transaction program which receives one employee number and returns the employee record could have a TIP which provides one call, passing the employee number as an IN
parameter and returning the employee record as an OUT
parameter. An additional two function calls must be provided by this and every TIP:
a remote transaction program init function call
a remote transaction program terminate function call
The most simple TIP has three public functions, such as tip_init
, tip_main
, and tip_term
.
The client application calls tip_init
, tip_main
, and tip_term
in succession. The corresponding activity at the remote site is remote transaction program start, data exchange, and remote transaction program end.
The remote transaction program might even terminate itself before receiving a terminate signal from the gateway. This sequence is usual and is handled normally by gateway logic. This kind of remote transaction program is termed one-shot.
A more complex remote transaction program has two modes of behavior: an INQUIRY
or reporting mode, and an UPDATE
mode. These modes can have two TIP data transfer function calls: one for INQUIRY
and one for UPDATE
. Such a TIP might have five public functions. For example:
This initializes communications with the remote transaction program.
This accepts a mode selection parameter and puts the transaction program into either inquiry or update mode.
This returns an employee record for a given employee number.
This accepts an employee record for a given employee number.
This terminates communications with the remote transaction program.
The client application calls tip_init
and then tip_mode
to place the remote transaction program in inquiry mode which then scans employee records, searching for some combination of attributes (known to the client application and end-user). Some parameter on an inquiry call is then set to signal a change to update mode and the client application calls tip_updt
to update some record. The client application finally calls tip_term
to terminate the remote transaction program.
The corresponding activity at the remote site is:
remote transaction program start
mode selection exchange
loop reading records
switch to update mode
update one record
remote transaction program end
Such a remote transaction program is called persistent because it interacts until it is signalled to terminate.
The remote transaction program can be written to permit a return to inquiry mode and repeat the entire process indefinitely.
A client application might need to get information from one transaction, tran_A
, and subsequently write or lookup information from another, tran_B
. This is possible with a properly written client application and TIPs for tran_A
and tran_B
. In fact, any number of transactions might be concurrently controlled by a single client application. All transactions could be read-only, with the client application retrieving data from each and consolidating it into a local Oracle database or displaying it in an Oracle Form.
Alternatively, a transaction could be capable of operating in different modes or performing different services depending on what input selections were supplied by the client application. For example, one instance of tran_C
can perform one service while a second instance of tran_C
performs a second service. Each instance of tran_C
would have its own unique conversation with the client application and each instance could have its own behavior (one-shot or persistent) depending on the nature of the service being performed.
Each remote host system might have hundreds of remote transaction programs (RTPs) which a user might want to call. Each remote transaction program is different, passes different data, and performs different functions. The interface between the user and each remote transaction program must consequently be specialized and customized to the user's requirements for each remote transaction program. The Transaction Interface Package provides this customized interface.
Example
Assume that the remote site has a transaction program which manages employee information in an employee database or other file system. The remote transaction program's name, in the remote host, is EMPT
for Employee Tracking. EMPT
provides both inquiry and update facilities, and different Oracle users are required to access and use these EMPT
facilities.
Some users might be restricted to inquiry-only use of EMPT
, while others might have update requirements. In support of the Oracle users' client applications, at least three possible TIPs could exist:
EMP_MGMT
to provide access to all facilities of the EMPT
remote transaction program.
EMP_UPDT
to access only the update functions of the EMPT
remote transaction program.
EMP_INQR
to access only the lookup functions of the EMPT
remote transaction program.
End-user access to these TIPs is controlled by Oracle privileges. Additional security might be imposed on the end-user by the remote host.
Each TIP also has encoded within it the name of the remote transaction program (EMPT
) and network information sufficient to establish an APPC conversation with EMPT
.
Using the TIP, the client application must correspond with and control the remote host transaction. This involves:
client application initialization
user input and output
remote host transaction initialization using the TIP initialization functions (with and without overrides)
remote host transaction control and data exchange using the TIP user functions
remote host transaction termination using the TIP termination function
exception handling
client application termination
Steps 3, 4 and 5 vary, based on the requirements of the remote host transaction.
One-shot remote host transaction client applications must:
Declare RHT/TIP datatypes to be exchanged. All client applications must declare variables to be exchanged with the RHTs using TIPs. PL/SQL datatypes for such variables have already been defined in the TIP corresponding to each RHT and the client application need only reference the TIP datatype in its declaration. Refer also to "Declaring TIP Variables" for more information. Also refer to the TIP content documentation file for the specific TIP/RHT for more information about the exact usage of these variables.
Initialize the RHT using the TIP initialization function. The TIP directs the gateway server to initialize a conversation with the desired RHT, specifying either default RHT identifying parameters (supplied when the RHT was defined in the PG DD and encoded within the TIP when it was generated) or override RHT identifying parameters supplied by the user or client application when the TIP initialization function is called. Refer to "Initializing the Conversation" and "Overriding TIP Initializations" for more details.
Exchange data with the RHT using the TIP user function (one call). As previously discussed, a one-shot remote host transaction only accommodates a single data exchange and upon completion of that exchange, the RHT terminates on its own. The client application consequently needs only to execute a single call to the user-defined TIP function to cause the data exchange.
Refer to the TIP content documentation file in %ORACLE_HOME%\dg4appc\demo\CICS\
on Microsoft Windows or $ORACLE_HOME/dg4appc/demo/CICS/
on UNIX based systems, for the specific TIP/RHT for the exact syntax of this call.
The client application should initialize values into IN
or IN OUT
parameter values before calling the TIP function call. These are the same variables that were declared above, when you declared the RHT/TIP datatypes to be exchanged.
All TIP function calls return a 0
return code value and all returned user gateway data values are exchanged in the function parameters. Any exception conditions are raised as required and can be intercepted in an exception handler.
Upon return from the TIP function call, the client application can analyze and operate on the IN OUT
or OUT
parameter values. These are the same variables that were declared above, when you declared the RHT/TIP datatypes to be exchanged.
Refer to Appendix D, "Datatype Conversions" for details about how TIPs convert the various types and formats of remote host data.
Terminate the RHT using the TIP termination function. Regardless of the type of RHT being accessed, the TIP terminate function should be called to clean up and terminate the conversation with the RHT. Conversations with one-shot RHTs can be terminated from the gateway server before the RHT terminates. The TIP must perform its cleanup as well. Cleanup is only performed at the termination request of the client application.
The client application can request a normal or an aborted termination.
Refer to "Terminating the Conversation" for more information.
Persistent remote host transaction client applications must:
Declare RHT/TIP datatypes to be exchanged. All client applications must declare variables to be exchanged with the RHTs using TIPs. PL/SQL datatypes for such variables have already been defined in the TIP corresponding to each RHT; the client application need only reference the TIP datatype in its declaration. Refer to "Declaring TIP Variables" for more information. Refer also to the TIP content documentation file for the specific TIP/RHT for more information about the exact usage of these variables.
Initialize the RHT using the TIP initialization function. The TIP directs the gateway server to initialize a conversation with the desired RHT, specifying either default RHT identifying parameters (supplied when the RHT was defined in the PG DD and encoded within the TIP when it was generated) or override RHT identifying parameters supplied by the user or client application when the TIP initialization function is called. Refer to "Initializing the Conversation" and "Overriding TIP Initializations" for more details.
Repetitively exchange data with RHT using the TIP user function(s). Remote host transactions that provide or require ongoing or repetitive control sequences should be controlled by the client application in the same manner that the RHT would be operated by an interactive user or other control program. The intercession of the TIP and gateway server does not alter the RHT behavior; instead, it extends control of that behavior to the client application using the various function calls defined in the TIP.
A persistent RHT can be controlled with one or more TIP function calls. The RHT might be designed, for example, to loop and return output for every input until the conversation is explicitly terminated. Or it could have been designed to accept as input a count or list of operations to perform and return the results in multiple exchanges for which the TIP function has only OUT
parameters.
A persistent RHT can also be interactive, each output being specified by a previous input selection and ending only when the conversation has been explicitly terminated by the client application.
The TIP function calls available to the client applications and their specific syntax is documented in the TIP Content documentation file for the specific TIP/RHT.
The manner in which the RHT interprets the TIP IN
parameters and returns TIP OUT
parameters must be determined from the RHT or explained by the RHT programmer. The TIP provides the function calls and the exchanged parameter datatypes to facilitate the client application's control of the RHT and imposes no limitations or preconditions on the sequence of operations the RHT is directed to perform. The TIP provides the client application with the calls and data parameters the RHT was defined to accept in the PG DD.
Terminate the RHT using the TIP termination function. Regardless of the type of RHT being accessed, the TIP terminate function should be called to clean up and terminate the conversation with the RHT. Conversations with persistent RHTs can be terminated from the gateway server before the RHT terminates, or the RHT might have already terminated. The TIP must perform its cleanup as well and this cleanup is only performed at the termination request of the client application.
The client application can request a normal or an aborted termination.
Refer to "Terminating the Conversation" for more information.
Multi-conversational remote host transaction client applications must:
Declare RHT/TIP datatypes to be exchanged. All client applications must declare variables to be exchanged with the RHTs using TIPs. PL/SQL datatypes for such variables have already been defined in the TIP corresponding to each RHT, and the client application need only reference the TIP datatype in its declaration. Refer to "Declaring TIP Variables" for more information. Also refer to the TIP content documentation file for the specific TIP/RHT for more information about the exact usage of these variables.
Initialize each RHT involved, using the TIP initializing function. A specific customized TIP exists for each RHT as defined in the PG DD. Client applications that control multiple RHTs are multi-conversational and must start each RHT and its associated conversation. This is done by calling each TIP initialization function as before; but multiple TIPs are initialized.
If a single RHT is designed to perform multiple services for one or more callers and if the client application is designed to use this RHT, the TIP corresponding to that RHT can be initialized multiple times by the client application.
The client application subsequently distinguishes from active RHTs under its control using:
TIP schema tipname.callname
when multiple TIP/RHTs are being controlled. By encoding the same TIP schema name on TIP user calls, the client application specifies to which RHT the call is being made.
tranuse
IN OUT
parameter value when multiple instances of the same TIP/RHT are being controlled. This is the value returned on the TIP initialization function call and subsequently passed as an IN
parameter on the user-defined TIP function calls. The returned tranuse
value corresponds to that conversation connected to a given instance of an RHT. By supplying the same tranuse
value on TIP user calls, the client application specifies to which RHT instance the given RHT call is being made.
Client application logic must keep track of which RHTs have been started and which TIPs and tranuse
values correspond to started RHTs.
Exchange data with each RHT, using the TIP user function(s), either once or repetitively if the RHT is one-shot or persistent. Client application logic must sequence the RHTs though their allowed steps in accordance with proper RHT operation, as does a user operating the RHTs interactively.
Client application logic must also perform any cross-RHT result analysis or data transfer that might be required. All TIPs execute in isolation from each other.
Output from one RHT intended as input to another RHT must be received in the client application as an IN
or IN OUT
parameter from the first RHT and sent as an IN
or IN OUT
parameter from the client application to the second RHT. All TIP-to-RHT function calls must be performed by the client application and data parameters exchanged must have been declared as variables by the client application. The TIPs provide both the required datatype definitions and the RHT function calls for the client application.
Refer to the TIP content documentation file for each specific TIP/RHT for the exact syntax of the TIP function calls and definitions of the parameter datatypes exchanged.
Terminate each initialized RHT, using the TIP termination function. To terminate an RHT, its corresponding TIP termination function must be called to terminate the RHT and its conversation and to initiate TIP cleanup. The RHT to be terminated is specified by its TIP schema name (the same schema as for its data exchange function calls) and the tranuse
value when multiple instances of the same RHT are being terminated.
RHTs and their corresponding TIPs can be terminated in any sequence desired by the client application and do not have to be terminated in the same order in which they are initialized.
Note: The specific syntax of the various TIP data exchange variables function calls is the same as was previously defined in the PG DD for the particular RHT and can be researched by examining the TIP content documentation file (tipname.doc ) or the TIP specification file produced when the TIP was generated. If a TIP has not yet been generated for the RHT being accessed, refer to Chapter 3, "Creating a TIP", and "DATA Correspondence", "CALL Correspondence", and "TRANSACTION Correspondence" for more information. It is preferable to define and generate the TIP first, however, so that the client application reference documentation is available to you when needed. |
A remote host transaction program and its related TIP with client application must correspond on two key requirements:
Parameter datatype conversion, which results from the way in which transaction DATA
is defined. Refer to Appendix D, "Datatype Conversions" for a discussion of how PGAU-generated TIPs convert data based on the data definitions.
APPC send/receive synchronization, which results from the way in which transaction CALL
s are defined
These DATA
and CALL
definitions are then included by reference in a TRANSACTION
definition.
Using data definitions programmed in the language of the remote host transaction, the PGAU DEFINE DATA
command stores in the PG DD the information needed for PGAU GENERATE
to create the TIP function logic to perform:
all data conversion from PL/SQL IN
parameters supplied by the receiving remote host transaction
all buffering into the format expected by the receiving remote host transaction
all data unbuffering from the format supplied by the sending remote host transaction
all data conversion to PL/SQL OUT
parameters supplied by the sending remote host transaction
PGAU determines the information needed to generate the conversion and buffering logic from the data definitions included in the remote host transaction program. PGAU DEFINE DATA
reads this information from files, such as COBOL copy books, or in-stream from scripts and saves it in the PG DD for repeated use. The gateway Administrator needs to transfer these definition files from the remote host to the Oracle host where PGAU runs.
From the data definitions stored in the PG DD, PGAU GENERATE
determines the remote host datatype and matches it to an appropriate PL/SQL datatype. It also determines data lengths and offsets within records and buffers and generates the needed PL/SQL logic into the TIP. Refer to the PGAU "DEFINE DATA" statement in Chapter 2, "Procedural Gateway Administration Utility" and "Sample PGAU DEFINE DATA Statements" in Appendix F, "Administration Utility Samples" for more information.
All data that are referenced as parameters by subsequent calls must first be defined using PGAU DEFINE DATA
. Simple data items, such as single numbers or character strings, and complex multi-field data aggregates, such as records or structures, can be defined. PGAU automatically generates equivalent PL/SQL variables and records of fields or tables for the client application to reference in its calls to the generated TIP.
As discussed, a parameter might be a simple data item, such as an employee number, or a complex item, such as an employee record. PGAU DEFINE DATA
automatically extracts the datatype information it needs from the input program data definition files.
In this example, empno
and emprec
are the arguments to be exchanged.
pgadb2i_main(trannum,empno,emprec)
A PGAU DEFINE DATA
statement must therefore be issued for each of these parameters:
DEFINE DATA EMPNO PLSDNAME (EMPNO) USAGE (PASS) LANGUAGE (IBMVSCOBOLII) ( 01 EMP-NO PIC X(6). ); DEFINE DATA EMPREC PLSDNAME (DCLEMP) USAGE (PASS) LANGUAGE (IBMVSCOBOLII) INFILE("emp.cob");
Note that a definition is not required for the trannum
argument. This is the APPC conversation identifier and does not require a definition in PGAU.
The requirement to synchronize APPC SEND
s and RECEIVE
s means that when the remote transaction program expects data parameters to be input, it issues APPC RECEIVE
s to read the data parameters. Accordingly, the TIP must cause the gateway to issue APPC SEND
s to write the data parameters to the remote transaction program. The TIP must also cause the gateway to issue APPC RECEIVE
s when the remote transaction program issues APPC SEND
s.
The PGAU DEFINE CALL
statement specifies how the generated TIP is to be called by the client application and which data parameters are to be exchanged with the remote host transaction for that call. Each PGAU DEFINE CALL
statement might specify the name of the TIP function, one or more data parameters, and the IN/OUT
mode of each data parameter. Data parameters must have been previously defined with PGAU DEFINE DATA
statements. Refer to "DEFINE CALL" in Chapter 2, "Procedural Gateway Administration Utility" and "Sample PGAU DEFINE CALL Statements" in Appendix F, "Administration Utility Samples" for more information.
PGAU DEFINE CALL
processing stores the specified information in the PG DD for later use by PGAU GENERATE
. PGAU GENERATE
then creates the following in the TIP package specification:
declarations of public PL/SQL functions for each CALL
defined with PL/SQL parameters for each DATA
definition specified on the CALL
declarations of the public PL/SQL data parameters
The client application calls the TIP public function as a PL/SQL function call, using the function name and parameter list specified in the PGAU DEFINE CALL
statement. The client application might also declare, by reference, private variables of the same datatype as the TIP public data parameters to facilitate data passing and handling within the client application, thus sharing the declarations created by PGAU GENERATE
.
In this example, the following PGAU DEFINE CALL
statement must be issued to define the TIP public function:
DEFINE CALL DB2IMAIN PKGCALL (pgadb2i_main) PARMS ((empno IN),(emprec OUT));
The number of data parameters exchanged between the TIP and the gateway on each call can vary at the user's discretion, as long as the remote transaction program's SEND/RECEIVE
requests are satisfied. For example, the remote transaction program data exchange sequence might be:
APPC SEND 5 fields (field1-field5) APPC RECEIVE 1 fields (field6) APPC SEND 1 field (field7) APPC RECEIVE 3 fields (field8 - field10)
The resulting TIP/application call sequence could be:
tip_call1(parm1 OUT, <-- APPC SEND field1 from remote TP parm2 OUT, <-- APPC SEND field2 from remote TP parm3 OUT); <-- APPC SEND field3 from remote TP tip_call2(parm4 OUT, <-- APPC SEND field4 from remote TP parm5 OUT); <-- APPC SEND field5 from remote TP tip_call3(parm6 IN OUT); --> APPC RECEIVE field6 in remote TP <-- APPC SEND field7 from remote TP tip_call4(parm8 IN, --> APPC RECEIVE field8 into remote TP parm9 IN, --> APPC RECEIVE field9 into remote TP parm10 IN); --> APPC RECEIVE field10 into remote TP
To define these four public functions to the TIP, four PGAU DEFINE CALL
statements must be issued, each specifying its unique public function name (tip_callx
) and the data parameter list to be exchanged. Once a data item is defined using DEFINE DATA
, it can be referenced in multiple calls in any mode (IN
, OUT
, or IN OUT
). For example, parm5
could be used a second time in place of parm6
. This implies the same data is being exchanged in both instances, received into the TIP and application on tip_call2
and returned, possibly updated, to the remote host in tip_call4
.
Notice also that the remote transaction program's first five written fields are read by two separate TIP function calls, tip_call1
and tip_call2
. This could also have been equivalently accomplished with five TIP function calls of one OUT
parameter each or a single TIP function call with five OUT
parameters. Then the remote transaction program's first read field (field6
) and subsequent written field (field7
) correspond to a single TIP function call (tip_call3
) with a single IN OUT
parameter (parm6
).
This use of a single IN OUT
parameter implies that the remote transaction program's datatype for field6
and field7
are both the same and correspond to the conversion performed for the datatype of parm6
. If field6
and field7
were of different datatypes, then they have to correspond to different PL/SQL parameters (for example, parm6
IN
and parm7
OUT
). They could still be exchanged as two parameters on a single TIP call or one parameter each on two TIP calls, however.
Lastly, the remote transaction program's remaining three RECEIVE
fields are supplied by tip_call4
parameters 8-10. They also could have been done with three TIP calls passing one parameter each or two TIP calls passing one parameter on one call and two parameters on the other, in either order. This flexibility permits the user to define the correspondence between the remote transaction program's operation and the TIP function calls in whatever manner best suits the user.
Each TIP public function first sends all IN
parameters, before it receives any OUT
parameters. Thus, a remote transaction program expecting to send one field and then receive one field must correspond to separate TIP calls.
For example:
tip_callO( parmO OUT); <-- APPC SEND outfield from remote TP
PGAXFER
RPC checks first for parameters to send, but finds none and proceeds to receive parameters:
tip_callI( parmI IN); --> APPC RECEIVE infield to remote TP
PGAXFER
RPC processes parameters to send and then checks for parameters to receive, but finds none and completes; therefore, a single TIP public function with an OUT
parameter followed by an IN
parameter does not work, because the IN
parameter is processed first--regardless of its position in the parameter list.
The remote host transaction is defined with the PGAU DEFINE TRANSACTION
statement with additional references to prior definitions of CALL
s that the transaction supports.
You specify the remote host transaction attributes, such as:
transaction ID or name
network address or location
system type (such as IBM370)
Oracle National Language of the remote host
Note: The PL/SQL package name is specified when the transaction is defined; this is the name by which the TIP is referenced and which the public function calls to be included within the TIP. Each public function must have been previously defined with a PGAUDEFINE CALL statement, which has been stored in the PG DD. If you do not specify a package name (TIP name) in the GENERATE statement, the transaction name you specified will become the package name by default. In that case, the transaction name (tname) must be unique and must be in valid PL/SQL syntax within the database containing the PL/SQL packages.
For more information, refer to "DEFINE TRANSACTION" in Chapter 2, "Procedural Gateway Administration Utility" and "Sample PGAU DEFINE TRANSACTION Statement" in Appendix F, "Administration Utility Samples". |
In this example, the following DEFINE TRANSACTION
statements are used to define a remote CICS transaction called DB2I
:
DEFINE TRANSACTION DB2I CALL ( DB2IMAIN, DB2IDIAG ) SIDEPROFILE(CICSPROD) TPNAME(DB2I) LOGMODE(ORAPLU62) SYNCLEVEL(0) NLS_LANGUAGE("AMERICAN_AMERICA.WE8EBCDIC37C");
Once a TIP is created, a client application must be written to interface with the TIP. A client application that calls the TIP functions must include five logical sections:
declaring TIP variables
initializing the conversation
exchanging data
terminating the conversation
error handling
The user declarations section of the tipname.doc
file documents the required declarations.
When passing PL/SQL parameters on calls to TIP functions, the client application must use the exact same PL/SQL datatypes for TIP function arguments as are defined by the TIP in its specification section. Assume, for example, the following is in the TIP specification, or tipname.doc:
FUNCTION tip_call1 tranuse, IN BINARY_INTEGER, tip_var1 io_mode pls_type1, tip_record io_mode tran_rectype) RETURN INTEGER; TYPE tran_rectype is RECORD (rec_field1 pls_type1, ... rec_fieldN pls_typeN);
Table 4-2 provides a description of the function declarations:
Table 4-2 Function Declarations
Item | Description |
---|---|
|
The TIP function name as defined in the package specification. |
|
The remote transaction instance parameter returned from the TIP init function identifying the conversation on which this TIP call is to exchange data. |
|
The PL/SQL record datatype declared in the |
|
Is a PL/SQL atomic datatype. |
|
Is a PL/SQL record field corresponding to a remote transaction program record field. |
In the client application PL/SQL atomic datatypes should be defined as the exact same datatype of their corresponding arguments in the TIP function definition. The following should be coded in the client application before the BEGIN
command:
appl_var pls_type1; /* declare appl variable for .... */
TIP datatypes need not be redefined. They must be declared locally
within the client application, appearing in the client application before the BEGIN
:
appl_record tipname.tran_rectype; /* declare appl record */
Table 4-3 describes the command line arguments:
Table 4-3 Command Line Arguments
Item | Description |
---|---|
|
The TIP function name as defined in the package specification. |
|
The remote transaction instance parameter returned from the TIP init function identifying the conversation on which this TIP call is to exchange data. |
|
The PL/SQL record datatype declared in the |
Refer to the tipname
.doc
content file for a complete description of the user declarations you can reference.
The client application calls the TIP public function as if it were any local PL/SQL function:
rc = tip_call1( tranuse, appl_var, appl_record);
In the CICS-DB2 inquiry example, the PL/SQL driver pgadb2id.sql
, which is located in %ORACLE_HOME%\dg4appc\demo\CICS
directory for Microsoft Windows and $ORACLE_HOME/dg4appc/demo/CICS
directory for UNIX based systems, is the client application and includes the following declaration:
... ... CREATE or REPLACE PROCEDURE db2idriv(empno IN CHAR) IS tranuse INTEGER :=0 /* transaction usage number */ DCLEMP PGADB2I.DCLEMP_typ; /* DB2 EMP row definition */ DB2 PGADB2I.DB2_typ; /* DB2 diagnostic information */ rc INTEGER :=0 /* PGA RPC return codes */ line VARCHAR2(132); /* work buffer for output */ term INTEGER :=0; /* 1 if pgadb2i_term called */ ... ...
The call to initialize the conversation serves several purposes:
To cause the PL/SQL package, the TIP, to be loaded and to perform the initialization logic programmed in the TIP initialization section.
To cause the TIP init function to call the PGAINIT
remote procedural call (RPC), which in turn establishes communication with the remote transaction program (RTP), and returns a transaction instance number to the application.
Optionally, calls to initialize the conversation can be used to:
Override default RHT/OLTP identification, network address attributes, and conversation security user ID and password.
Specify what diagnostic traces the TIP is to produce. Refer to Chapter 8, "Troubleshooting" for more information about diagnostic traces.
PGAU-generated TIPs provide four different initialization functions that client applications can call. These are overloaded functions which all have the same name, but vary in the types of parameters passed.
Three initialization parameters are passed:
The transaction instance number for RHT conversation identification. The tranuse
parameter is required on all TIP initializations.
TIP diagnostic flags for TIP runtime diagnostic controls. The tipdiag
parameter is optional. Refer to Chapter 8, "Troubleshooting" for a discussion of TIP diagnostics.
TIP default overrides for overriding OLTP and network attributes. The override
parameter is optional.
The following four functions are shown as they might appear in the TIP Content documentation file. Examples of client application use are provided later.
TYPE override_Typ IS RECORD ( tranname VARCHAR2(255), /* Transaction Program */ transync BINARY_INTEGER, /* RESERVED */ trannls VARCHAR2(50), /* RESERVED */ oltpname VARCHAR2(255), /* Logical Unit */ oltpmode VARCHAR2(255), /* LOG Mode Entry */ netaddr VARCHAR2(255), /* Side Profile */ oltpuser VARCHAR2(8), /* userid for OLTP access */ oltppass VARCHAR2(8)); /* password for OLTP access*/ FUNCTION pgadb2i_init( /* init standard */ tranuse IN OUT BINARY_INTEGER) RETURN INTEGER; FUNCTION pgadb2i_init( /* init override */ tranuse IN OUT BINARY_INTEGER, override IN override_Typ) RETURN INTEGER; FUNCTION pgadb2i_init( /* init diagnostic */ tranuse IN OUT BNARY_INTEGER, tipdiag IN CHAR) RETURN INTEGER; FUNCTION pgadb2i_init( /* init over-diag */ tranuse IN OUT BINARY_INTEGER, override IN override_Typ, tipdiag IN CHAR) RETURN INTEGER;
This transaction instance number (shown in examples as tranuse
) must be passed to subsequent TIP exchange and terminate functions. It identifies to the gateway on which APPC conversation--and therefore which iteration of a remote transaction program--the data is to be transmitted or communication terminated.
A single client application might control multiple instances of the same remote transaction program or multiple different remote transaction programs, all concurrently. The transaction instance number is the TIP's mechanism for routing the client application call through the gateway to the intended remote transaction program.
It is the responsibility of the client application to save the transaction instance number of each active transaction and pass the correct one to each TIP function called for that transaction.
The client application calls the TIP initialization function as if it were any local PL/SQL function. For example:
... ... tranuse INTEGER := 0;/* transaction usage number*/ ... ... BEGIN rc := pgadb2i.pgadb2i_init(tranuse); ... ...
Note that in the preceding example the client application did not specify any remote transaction program name, network connection, or security information. The TIP has such information internally coded as defaults and the client application simply calls the appropriate TIP for the chosen remote transaction program. The client application can, however, optionally override some TIP defaults and supply security information.
You do not need to change any client applications that do not require overrides.
When the remote host transaction was defined in the PG DD, the DEFINE TRANSACTION
statement specified certain default OLTP and network identification attributes which can be overridden:
TPname
LUname
LOGMODE
Side Profile