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


Chapter 10 Accessing External Routines : Making a PL/I Program Compatible with TIBCO Object Service Broker

Making a PL/I Program Compatible with TIBCO Object Service Broker
Requirements
You can write a PL/I program as a callable routine in TIBCO Object Service Broker but you cannot write your PL/I program as a function (that is, you cannot write your PL/I program to return a value unless you pass the value back through an argument).
Link-Edit Options
Link-edit a PL/I program with option ENTRY PLICALLA.
Syntax Mapping
The following table shows how TIBCO Object Service Broker syntax is mapped to PL/I syntax.

PL/I Syntax Declaration #
CHAR(n) VARYING
n = 4
n = 8
n = 16

1
An RD field consists of a 4‑byte non-exclusive binary length followed by the data.

Example PL/I Program
The external routine in the following example takes a number in the first argument and returns the logarithm of the number in the second argument. The routine and its arguments must be identified to TIBCO Object Service Broker as described in Identifying Your External Routine to TIBCO Object Service Broker.

 
plilog: proc(number,result) options(main);
  dcl (number,result) binary float (21);
  dcl log10 builtin;
  result= log10(number);
end plilog;

 
External PL/I Routine to Concatenate Strings for TIBCO Object Service Broker
The external routine in the following example concatenates a string to itself a specified number of times. To return a value in a non-numeric argument, the PL/I program must use a pointer to access the argument; therefore, STRING points to the PSTRING argument. The routine and its arguments must be identified to TIBCO Object Service Broker as described in Identifying Your External Routine to TIBCO Object Service Broker.

 
/* PLISTR - EXAMPLE PROGRAM */
/* OSB ROUTINES table contains the following: */
/* PLISTR PL/I N 0 0 */
/* OSB ARGUMENTS(PLISTR) table contains the following: */
/* 1 PSTRING Y S C 128 */
/* 2 PLENGTH N Q B 2 */
plistr: proc(pstring,plength) options(main);
  dcl (pstring) fixed bin(15)
  dcl (plength) fixed bin(15);
  dcl string char(128) based(p1),
      p1 pointer init(addr(pstring));
  string= repeat('xyz ' ,plength);
end plistr;

 
See Also
TIBCO Object Service Broker Programming in Rules about TIBCO Object Service Broker syntax.

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