IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Array in Cobol Db2 Stored Procedure


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Ashishpanpaliya

New User


Joined: 13 Oct 2017
Posts: 34
Location: India

PostPosted: Wed Jan 09, 2019 3:06 pm
Reply with quote

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
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Wed Jan 09, 2019 5:05 pm
Reply with quote

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
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Wed Jan 09, 2019 9:26 pm
Reply with quote

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
View user's profile Send private message
Ashishpanpaliya

New User


Joined: 13 Oct 2017
Posts: 34
Location: India

PostPosted: Wed Jan 09, 2019 10:02 pm
Reply with quote

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
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Wed Jan 09, 2019 11:26 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Generate random number from range of ... COBOL Programming 3
Search our Forums:

Back to Top