View previous topic :: View next topic
|
Author |
Message |
Ashishpanpaliya
New User
Joined: 13 Oct 2017 Posts: 34 Location: India
|
|
|
|
Hi
I have requirement to accept array input variable. I did little google & found some references but not specific to COBOL.
So would be great if someone suggest their experiences.
Step 1 - How to define array in DDL that define SP in DB2
Create Procedure SPname1
( In Variable1 char(08) array[varchar(100)];
out variable2 Integer array[100];
) .
Is above way of writing correct?
Step 2 - How do we define this array in linkage section of cobol SP .
is it the same way that define array(table) in cobol program. |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
Try your suggestions. If they work post to confirm it. If they do not, post to say that one, or both, of those are not correct. |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3048 Location: NYC,USA
|
|
|
|
If you can live with Native SP then try this Example of using arrays in an SQL procedure
These type of stuff is done by DBAs , please check with all the options available with the DB2 version that you have at your site. However you can still use XML instead if not array. |
|
Back to top |
|
|
Ashishpanpaliya
New User
Joined: 13 Oct 2017 Posts: 34 Location: India
|
|
|
|
Thanks Rohit. But the first line in the link says ' An example demonstrates many of the ways that you can use arrays in a native SQL procedure. '
So I am interested in example of external SP.
We are using V12. |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3048 Location: NYC,USA
|
|
|
|
That’s why I said you can write in Native and you have that choice then you can use it for external i never worked on array but xml or clob or varchar and I could not find in manuals as well that mentiones of array ( unless someone finds it which I couldn’t)
Why can’t you use native ? If you wants to use external then what’s the issue with xml or pass it in varchar (separated by pipe or anything ) and you get it unsteing in the program later.
www.ibm.com/support/knowledgecenter/en/SSEPEK_12.0.0/apsg/src/tpc/db2z_datatypesstoredprocedures.html
Also, please loop DBAs first for any possible design approach if not done already. |
|
Back to top |
|
|
|