MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

NULL Indicators in DB2 stored proc for OUT Parameters

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
vjpilp
Beginner


Joined: 01 May 2004
Posts: 8
Topics: 2

PostPosted: Thu Jul 15, 2004 1:56 pm    Post subject: NULL Indicators in DB2 stored proc for OUT Parameters Reply with quote

Is it possible to send NULL values in an out parameter to a calling program when my stored proc is written in COBOL?
I tried this:
LINKAGE SECTION
10 LS-TEXT PIC X(10).
10 LS-TEXT-NI PIC S9(04) COMP.

If I set LS-TEXT-NI = -1 , the value received in the calling program(Java) is not NULL.

Is there a way to send back NULL is OUT parameter?
Back to top
View user's profile Send private message
Bithead
Advanced


Joined: 03 Jan 2003
Posts: 550
Topics: 23
Location: Michigan, USA

PostPosted: Thu Jul 15, 2004 2:07 pm    Post subject: Reply with quote

Try This

01 LS-TEXT.
49 LS-TEXT-NI PIC S9(04) COMP.
49 LS-TEXT PIC X(10).


Then move +0 to LS-TEXT-NI for NULL values.
Back to top
View user's profile Send private message
SureshKumar
Intermediate


Joined: 23 Jan 2003
Posts: 211
Topics: 21

PostPosted: Thu Jul 15, 2004 2:12 pm    Post subject: Reply with quote

Vipilp,
The answer is yes. You can send nulls. Look at how the stored procedure is defined. Something like PARAMETER STYLE GENERAL WITH NULLS
Moreover, if you have a group item its has to be defined at a 01 level. The null indicator acts on a given 01 level. example

01 LS-TEXT-1 PIC X(10).
01 LS-TEXT-2 PIC X(10).
01 LS-TEXT-3 PIC X(10).

01 NULL-INDICATORS.
10 LS-TEXT-NI-1 PIC S9(04) COMP.
10 LS-TEXT-NI-2 PIC S9(04) COMP.
10 LS-TEXT-NI-3 PIC S9(04) COMP.
Back to top
View user's profile Send private message
vjpilp
Beginner


Joined: 01 May 2004
Posts: 8
Topics: 2

PostPosted: Thu Jul 15, 2004 10:23 pm    Post subject: Reply with quote

The stored procedure is defined with parameter style as DB2SQL(can pass NULLS).
1. When I send NULL values from Java, I receive NULL indicators only for integers i.e S9(09) COMP. For other data types, I receive some garbage value. Am I doing something wrong here?

2. With parameter style definition, does it mean that my Java program alone can send NULLS or is it that my COBOL-DB2 program can send back NULLS to JAva?
Back to top
View user's profile Send private message
SureshKumar
Intermediate


Joined: 23 Jan 2003
Posts: 211
Topics: 21

PostPosted: Fri Jul 16, 2004 8:12 am    Post subject: Reply with quote

vipilp,
I am not sure if DB2SQL can receive nulls if 'GENERAL WITH NULLS ' is not specified. check the manuals. Moreover, for type DB2SQL the null indicators have to be defined at 01 level in the SP and the calling program myst explictly use them.
The good thing abour the SP's is that IBM has provided clear example of each type of parameter and how it can be used. There are different elements that needs to be looked at, so give it a try..refer to this manual if you have not done so..thanks
IBM Redbook : DB2 for z/OS Stored Procedures: Through the CALL and Beyond
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group