Re: How many parameters in a UDF?

Harvey Wachtel

Re: How many parameters in a UDF?
(in response to James Campbell)
I don't know much about COBOL, but from my general programming experience,
I'd say that chasing save area chains is a dangerous pursuit. What if
someone changes the way the compiler works in the future, say to use BAKR
instead of STM?

I know nothing about UDFs, so I have to assume that the obvious solution,
passing the number of parameters as the first parameter, is not available.
If nothing else comes up, I'd suggest that instead of writing the
dangerous-to-maintain assembler subroutine, you might consider an assembler
front end that analyzes the parameter list and somehow passes the number of
parameters on to the COBOL program, either by inserting it into a dummy
parameter provided for that purpose or, as a last resort, by building a new
parameter list with an extra halfword parameter at the beginning.



Campbell James
<[login to unmask email] To: [login to unmask email]
IS.COM.AU> cc:
Sent by: DB2 Data Base Subject: How many parameters in a UDF?
Discussion List
<[login to unmask email]>


1999-12-14 19:56
Please respond to DB2
Data Base Discussion
List





We have started to write UDF's in DB2 UDB for OS/390. One problem we
are finding is how to determine the number of parameters passed to one.
This is a problem when we want to have the same program receive
differing numbers of parameters.

There is an example in SDSNSAMP, but it is written in C (and hence can
use (argc, argv) to specify parameters). We want something that works
in COBOL.

The thoughts I have had are:
- write an assembler routine to track back through save areas to find R1
that was passed to the COBOL program and scan its parameter list looking
for the end-flag
- scan the parameters looking for 'n' indicator variables (ie the first
byte is x'00') in parameters n+1 to 2n; pick up the specific name from
parameter 2n+3; verify, from SYSROUTINES, that there are n-1 input
parameters to the function. (The output value being going into the
n'th.) Yeech!

Anyone else have any suggestions. Like, is there something obvious that
we are missing - or is this really the way it was designed?

/* standard disclaimer */
James Campbell
DBA
Hansen Corporation, Doncaster
+61 3 9840 3864
[login to unmask email]








James Campbell

How many parameters in a UDF?
We have started to write UDF's in DB2 UDB for OS/390. One problem we
are finding is how to determine the number of parameters passed to one.
This is a problem when we want to have the same program receive
differing numbers of parameters.

There is an example in SDSNSAMP, but it is written in C (and hence can
use (argc, argv) to specify parameters). We want something that works
in COBOL.

The thoughts I have had are:
- write an assembler routine to track back through save areas to find R1
that was passed to the COBOL program and scan its parameter list looking
for the end-flag
- scan the parameters looking for 'n' indicator variables (ie the first
byte is x'00') in parameters n+1 to 2n; pick up the specific name from
parameter 2n+3; verify, from SYSROUTINES, that there are n-1 input
parameters to the function. (The output value being going into the
n'th.) Yeech!

Anyone else have any suggestions. Like, is there something obvious that
we are missing - or is this really the way it was designed?

/* standard disclaimer */
James Campbell
DBA
Hansen Corporation, Doncaster
+61 3 9840 3864
[login to unmask email]