Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Native SQL - Parameter Style General With Nulls

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

New User


Joined: 08 Jan 2009
Posts: 20
Location: Chennai

PostPosted: Thu Mar 01, 2012 9:19 pm    Post subject: Native SQL - Parameter Style General With Nulls
Reply with quote

Hi,

I am writing a Native SQL Stored Procedure for both Insert and Update.

In my program, I have two input variables 1) New User Name and 2) Old User NAme. If I get the Values in both the fields then my SP would update the DB2 Table with New User Name. If there are no values in the Old User Name then an Insertion would happen.

I hope we can use PARAMETER STYLE GENERAL WITH NULLS in Native SQL. But I am not sure where we declare the Parameter Null indicators for the INput values. In COBOL we have the Parameter NULL indicators in Linkage Section using which, we can validate for nulls.

Could you please let me know how to check the NULL indicators in Native SQL.

EG:-
CREATE PROCEDURE EMP.NATIVE_SQL (
NEW_EMP_NAME IN CHAR(50)
, OLD_EMP_NAME IN CHAR(50)
)
LANGUAGE SQL
WLM ENVIRONMENT PRODWLM
MODIFIES SQL DATA
PARAMETER STYLE GENERAL WITH NULLS

Start: ...............

>> Checking for NEW_EMP_NAME for NULL would be suffice here. Please advise.
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Mar 07, 2012 7:20 am    Post subject:
Reply with quote

Hello,

I believe one of us is confused. . .

If you want to check some value in the program (field n a file or working-storage etc) for "NULL", i know of no way to do this - there is no NULL value in the ebcdic value table. Every value from x'00' to x'FF' is valie and is NOT a null value.

If you want to insert a null value, you would set the null-indicator to -1 which tells sql this value is numm (contains no value at all).

Possibly i misunderstand?
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1281
Location: Belgium

PostPosted: Wed Mar 07, 2012 4:23 pm    Post subject:
Reply with quote

how about :

IF NEW_EMP_NAME is NULL then SIGNAL ...;

IF OLD_EMP_NAME is NULL then
insert ...
ELSE
update ...
;
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 JTS parameter Shashank Chaubey JCL & VSAM 2 Thu Jul 13, 2017 4:15 pm
No new posts Include/omit with "ALL" pa... mgl DFSORT/ICETOOL 6 Wed Jun 14, 2017 2:31 pm
No new posts Can DFSPARM override SORTKEYS paramet... ashek15 DB2 2 Tue Jan 31, 2017 11:36 pm
No new posts DDNAME parameter mistah kurtz JCL & VSAM 6 Mon Dec 19, 2016 4:41 pm
No new posts Execessive parameter issue Sumeendar JCL & VSAM 5 Mon Dec 19, 2016 4:35 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us