External Call support for Stringlists and $lists
External Call enhancements
A Stringlist object or $list identifier can be passed to an ECF program, as in:
external call cobprog with inStringlist outStringlist
where:
inStringlist | The Stringlist object whose contents are to be passed to the ECF program as input. |
---|---|
outStringlist | The Stringlist object to receive the data as modified by the ECF program. The contents of this Stringlist are replaced with the ECF program output. The length of the Stringlist items are made to match that of the input Stringlist, and if the output Stringlist is the same identifier as the input Stringlist, the output data simply replaces the original input data. For PARMTYPE=INPUT ECF programs, the output Stringlist is ignored.
|
or
external call cobprog with $list inlist outlist
where:
inlist | The $list identifier whose contents are to be passed to the ECF program as input. |
---|---|
outlist | The $list identifier to receive the data as modified by the ECF program. The contents of this $list are replaced with the ECF program output. The length of the $list items are made to match that of the input $list, and if the output $list is the same identifier as the input $list, the output data simply replaces the original input data. For PARMTYPE=INPUT ECF programs, the output $list is ignored.
|
In the following discussion, all references to Stringlist also apply to $lists. Stringlist is used here because their use is recommended over the use of $lists.
The input Stringlist contents are copied into the ECF parameter area before the ECF program is called. The Stringlist items are concatenated and there is no way to determine where one ends and the next begins, so presumably the Stringlist items would all have the same length, or some Stringlist items have the length or number of occurrences of a following set of Stringlist items (which can be used in the ECF program to determine the structure of the data).
More likely, the structure for passing data from a Stringlist to an ECF program will be a Stringlist where all Stringlist items have the same length. To facilitate use of such a structure, the Stringlist/$list ECF interface automatically places a one word (four byte) binary number of occurrences before the copied Stringlist items in the ECF parameter area. This makes it possible, if the ECF program is written in COBOL, to refer to the Stringlist as a DEPENDING
array where the number of occurrences can vary at run-time.
To refer to the $list, the COBOL program would look something like this:
LINKAGE SECTION. 01 STUBB. 03 NUM-HARPOONS PIC 9(9) BINARY 03 HARPOON-INFO OCCURS 0 TO 25000 TIMES DEPENDING ON NUM-HARPOONS. ... PROCEDURE DIVISION USING STUBB.
If for some reason, this count is deemed undesirable in the linkage structure, it can be suppressed via the NOCOUNT
keyword in the External Call
statement as in:
external call cobprog with %stringlist nocount
or
external call cobprog with $list %list nocount
Multiple stringlists, $lists, and images can be passed in a single ECF call as in:
external call conbprog with %stringlist1, $list %list, inimage, $list %list2, %stringlist2