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

Regarding COBOL Stored Procedure option - GENERAL WITH NULLS


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

New User


Joined: 09 Aug 2010
Posts: 31
Location: Chennai

PostPosted: Fri Nov 04, 2016 8:57 pm
Reply with quote

Hi all,

I have coded a COBOL Stored procedure (DB2) program, for which I am facing 2 issues. I have went through the ibm knowledge center and did exactly the same.

1.Didn't coded Null variable as Out parameter in CREATE PROCEDURE (SP definition). All other IN and OUT parameters coded. Initially setting all the Null fields to true. Based on query result, I am setting Null variables to 0 and moving corresponding values to Out variables in COBOL SP. After running SP using IBM Rational tool, I am only able to see Null values in OUT parameters.

Link : www.ibm.com/support/knowledgecenter/SSEPEK_11.0.0/apsg/src/tpc/db2z_xmpcobolstoredproceduregeneralwithnulls.html

2. In that SP, I am selecting columns of more than 2 tables with Alias for identifcation. On Compiling, I am getting DSNH2061 W "STATEMENT REFERENCES COLUMN "A"."COLUMN_NAME" WHICH IS NOT DECLARED IN THE SPECIFIC TABLES. But the bind is successful.
While running in IBM Rational tool, Result sets are coming without column names of table. How to remove Alias and connect more than 2 tables.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


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

PostPosted: Fri Nov 04, 2016 10:02 pm
Reply with quote

Quote:
Result sets are coming without column names of table.
That is how it will be, why do you need column name here?
Quote:
How to remove Alias and connect more than 2 tables.
why remove for the same column appearing in both or multiple tables, you will get err?
Back to top
View user's profile Send private message
selvamsrinivasan85

New User


Joined: 09 Aug 2010
Posts: 31
Location: Chennai

PostPosted: Fri Nov 04, 2016 10:35 pm
Reply with quote

Hi Rohit,

I am not facing any issue incase of native SP. I used to get column names in Result set.

I hope removing Alias will resolve this issue 2.

Want alias on where clause like below. Suggestions please.

Select Col1_tb1, Col2_tb1, Col1_tb2, Col2_tb2 from Table1 A, Table2 B where A.id = B.id;

Any suggestions on issue 1 will be grateful.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


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

PostPosted: Fri Nov 04, 2016 10:41 pm
Reply with quote

Is that what you lookingg for?
Code:
Select Col1_tb1 as col1,
Col2_tb1 as col2,
Col1_tb2 as col3,
Col2_tb2 as col4
from Table1 A, Table2 B
where A.id = B.id;
Back to top
View user's profile Send private message
selvamsrinivasan85

New User


Joined: 09 Aug 2010
Posts: 31
Location: Chennai

PostPosted: Fri Nov 04, 2016 10:46 pm
Reply with quote

Hi Rohit,
You gave me a clue. Thanks.

I think below will work fine. Will try and let you know.

Code:
Select A.Col1_tb1 as col1,
A.Col2_tb1 as col2,
B.Col1_tb2 as col3,
C.Col2_tb2 as col4
from Table1 A, Table2 B
where A.id = B.id;


Code'd by Rohit Umarjikar
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 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 SCOPE PENDING option -check data DB2 2
No new posts Generate random number from range of ... COBOL Programming 3
Search our Forums:

Back to Top