View previous topic :: View next topic
|
Author |
Message |
NikhilGuptaGaya
New User
Joined: 28 May 2018 Posts: 5 Location: India
|
|
|
|
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 |
|
|
Tushar Sood
New User
Joined: 26 Oct 2008 Posts: 14 Location: New Jersey
|
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3051 Location: NYC,USA
|
|
|
|
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 |
|
|
NikhilGuptaGaya
New User
Joined: 28 May 2018 Posts: 5 Location: India
|
|
|
|
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 |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3051 Location: NYC,USA
|
|
|
|
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 |
|
|
Tushar Sood
New User
Joined: 26 Oct 2008 Posts: 14 Location: New Jersey
|
|
|
|
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 |
|
|
|