Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Varying List Select SQL Query In DB2 Cobol Program

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
NikhilGuptaGaya

New User


Joined: 28 May 2018
Posts: 5
Location: India

PostPosted: Wed Jun 27, 2018 11:01 pm    Post subject: Varying List Select SQL Query In DB2 Cobol Program
Reply with quote

How SQLDA fields are mapped with the retrieved columns from varying list select sql query? and how parameter marker to be used in this case?

Support with example please....
Back to top
View user's profile Send private message

Tushar Sood

New User


Joined: 26 Oct 2008
Posts: 11
Location: New Jersey

PostPosted: Thu Jun 28, 2018 1:17 am    Post subject: Reply to: Varying List Select SQL Query In DB2 Cobol Program
Reply with quote

Hi Nikhil,

Check if the link helps:

https://www.ibm.com/support/knowledgecenter/en/SSEPEK_12.0.0/apsg/src/tpc/db2z_samplecoboldynamicsql.html
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 2016
Location: NY,USA

PostPosted: Thu Jun 28, 2018 8:45 pm    Post subject:
Reply with quote

In your last post , it is already said that you need to learn How to code Dynamic SQLs in Cobol but looks like you are making no efforts.
Code:
 See if you get it, I will try to narrate important steps..
1. Set you # of columns to SQLN OF SQLDAVAR
2. At this point,  it is assumed that, your query is already ready in host variable say SQLSTMT.
3. PREPARE STMT( e.g.) INTO :SQLDAVAR FROM :SQLSTMT
4. SQLD OF SQLDAVAR is populated with actual number of columns after step3 is executed ( different than step1) and move it to SQLN OF SQLDAVAR
5. Next step is to establish address for storing column value till end of all columns found in step4.  So use SQLDATA OF SQLDAVAR, SQLIND  OF SQLDAVAR, SQLTYPE OF SQLDAVAR and SQLLEN OF SQLDAVAR to SET ADDRESS to local defined Descriptor table and to also calculate the actual length of various data type columns.
6. Now you do set up the Parameter markers here, clue is to use SQLDATA OF SQLDAPRM pointer and play around with offsets based on your Host variable(should sync up with table structure and data types) to set markers
7. Now time to get all selected rows(FETCH cursor USING DESCRIPTOR :SQLDAVAR)
Back to top
View user's profile Send private message
NikhilGuptaGaya

New User


Joined: 28 May 2018
Posts: 5
Location: India

PostPosted: Thu Jun 28, 2018 10:04 pm    Post subject:
Reply with quote

Thank you Tushar and Rohit.

I am studying it and going through the link which Tushar had provided. I will come back if I get any doubts in that. However, the URL is very useful. I am studying it. Thank you once again.

Regards,
Nikhil Gupta
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 2016
Location: NY,USA

PostPosted: Thu Jun 28, 2018 10:07 pm    Post subject:
Reply with quote

I would suggest you to find any existing program which uses this and see the logical flow and then get into specific area if not understood which is the easiest way to learn.
Back to top
View user's profile Send private message
Tushar Sood

New User


Joined: 26 Oct 2008
Posts: 11
Location: New Jersey

PostPosted: Sat Jun 30, 2018 7:59 pm    Post subject:
Reply with quote

NikhilGuptaGaya wrote:
Thank you Tushar and Rohit.

I am studying it and going through the link which Tushar had provided. I will come back if I get any doubts in that. However, the URL is very useful. I am studying it. Thank you once again.

Regards,
Nikhil Gupta



Nice to know that it helped...
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to find if segment is read in any... Priyanka AR IMS DB/DC 7 Thu Sep 20, 2018 1:34 pm
No new posts U0437 to execute IMS DC program Vkp321 IMS DB/DC 6 Wed Sep 19, 2018 8:39 pm
No new posts Generate SQL query dynamically using ... vnktrrd DB2 7 Tue Aug 28, 2018 8:11 pm
No new posts COBOL - JSON GENERATE husni1972 COBOL Programming 1 Fri Aug 17, 2018 3:29 am
No new posts Send data from a CICS TS program to M... spiThingy CICS 2 Wed Aug 08, 2018 8:58 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us