Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved


Chapter 21 Coding TIBCO Object Service Broker Access Statements : Writing COBOL with TIBCO Object Service Broker Access Statements

Writing COBOL with TIBCO Object Service Broker Access Statements
To access a TIBCO Object Service Broker table from your COBOL program you must add TIBCO Object Service Broker access statements. These statements are converted into valid COBOL statements by the TIBCO Object Service Broker preprocessor. This section provides an example of a COBOL program coded with TIBCO Object Service Broker access statements and the associated TIBCO Object Service Broker table definition. It also explains the statements you require for your program. For information on coding SQL statements in a COBOL program, refer to Chapter 22, Coding SQL Access Statements.
Sample COBOL Program
The following sample shows a COBOL program containing TIBCO Object Service Broker access statements. The following conventions are used in the example:
Example

 
CBL MAP,RENT,NOSEQUENCE,TEST(SYM),THREAD,VBREF,OFFSET
IDENTIFICATION DIVISION.
PROGRAM-ID. COBOSTMT RECURSIVE.
AUTHOR. JOHN SMITH.
INSTALLATION. TIBCO Software Inc.
DATE-COMPILED.
**********************************************************************
* Demonstration of HLI Preprocessor *
* A COBOL program with TIBCO Object Service Broker access statements *
* for TSO or batch TIBCO Object Service Broker sessions. *
* *
* To execute this Cobol program, you must make an entry in the *
* OSB ROUTINES table such as: *
* NAME :COBOSTMT *
* LANGUAGE :LEPERSIST *
* FUNCTION :N *
* LOADNAME :COBOSTMT *
* *
* Invoke the program via a RULE call: *
* CALL 'COBOSTMT'; *
* *
* The program uses the table #ED_EMPLOYEES as its data source. *
* *
**********************************************************************
ENVIRONMENT DIVISION.
*
DATA DIVISION.
*
WORKING-STORAGE SECTION.
*
* Variables in this section remain in their last state for
* every invokation of this subroutine within a run-unit /
* enclave.
*
77 USER-ID-77 PIC X(16) VALUE 'EDUC'.
77 LOCATION-77 PIC X(16) VALUE 'A'.
* Include Statement.
$ Include Huron;
* ***
* Define table Employee and translate non-Cobol names
* to acceptable Cobol names.
* ***
$ Define Table Employee = #ED_EMPLOYEES
$ Parameter USER-ID = USERID,
$ LOCATION-PARM = LOCATION
$ Field mgrno = MGR#,
$ zipcode = P_CODE;
*
LOCAL-STORAGE SECTION.
*
* Variables in this section are initialized at each invokation.
*
LINKAGE SECTION.
*
* Variables in this section are passed from/to caller on each
* invokation. Use ARGUMENTS table to define parameters to pass
* and the "PROCEDURE DIVISION USING parm1, parm2" etc to pass
* entries to the external routine as necessary. Each parameter
* should be a LINKAGE SECTION 01 entry.
*
PROCEDURE DIVISION.
MAINLINE-CODE SECTION.
$ Entry;
DISPLAY 'ENTERED COBOSTMT COBOL PROGRAM'.
* Get and display names of selected employees.
* Set USER-ID-77 and LOCATION-77 to appropriate values
* for your system
$ Forall Employee(USER-ID-77,LOCATION-77)
$ where mgrno = 84021 :
DISPLAY EMPLOYEE-LNAME.
$ end;
EXIT-HERE.
DISPLAY 'ABOUT TO EXIT COBOSTMT COBOL PROGRAM'.
GOBACK.

 
Sample TIBCO Object Service Broker Table Definition
The following definition is of the table #ED_EMPLOYEES. This is the TIBCO Object Service Broker table used by the COBOL program with embedded TIBCO Object Service Broker access statements. (Only the first 80 columns are shown.)
Partial Definition of the #ED_EMPLOYEES Table

 
COMMAND==> TABLE DEFINITION
Table: #ED_EMPLOYEES Type: TDS Unit: EDUC IDgen: N
Parameter Name Typ Syn Len Dec Class ' Event Rule Typ Acc
---------------- - - --- -- - ' ---------------- - -
_ USERID I C 16 0 D ' _
_ LOCATION I C 16 0 L ' _
Field Name Typ Syn Len Dec Key Ord Rqd Default Reference
---------------- - - ---- -- - - - ---------------- --------------
_ EMPNO I P 3 0 P
_ LNAME S C 22 0
_ POSITION S C 14 0
_ MGR# I P 3 0 MANAGER
_ DEPTNO I B 2 0
_ SALARY Q P 3 2
_ HIREDATE D B 4 0
_ ADDRESS S V 38 0
_ CITY S C 20 0
_ PROV S C 3 0
_ P_CODE S C 7 0
_
_
PFKEYS: 3=END 12=CANCEL 22=DELETE 13=PRINT 14=FIELDS 21=DATA 2=DOC

 

Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved