IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search Log in to check your private messages Log in
 

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: 32
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: 2432
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: 2508
Location: NY,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: 32
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: 2508
Location: NY,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.

Use [URL] BBCode for Links

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

 

Search our Forum:

Similar Topics
Topic Forum Replies
No new posts COBOL Performance Tuning COBOL Programming 5
No new posts JCL for replacing code in Cobol JCL & VSAM 8
No new posts COBOL VS SORT Utility for file format... COBOL Programming 6
No new posts XML Parsing in COBOL creating "h... COBOL Programming 0
No new posts Calling Rexx program from Cobol CLIST & REXX 12

Back to Top