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
 

 

Null Identifier

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

New User


Joined: 29 Aug 2005
Posts: 35

PostPosted: Mon Aug 29, 2005 7:07 am    Post subject: Null Identifier
Reply with quote

What is a Null Identifier ?
I am aware of Null value in a Database & Null Statement in COBOL, but
i dont know waht's a Null Identifier.

Pls help me out.

Thanks,
Anu.
Back to top
View user's profile Send private message

mathiprakash

New User


Joined: 29 Apr 2005
Posts: 14
Location: Pune, India.

PostPosted: Mon Aug 29, 2005 10:45 am    Post subject:
Reply with quote

Hi AnuB,

Null Identifier will be used in case of embedded SQL. Let me explain this with example.

Consider this embedded query.

EXEC SQL
SELECT
EMP_PHONE_NUM
INTO
:EMP-PHONE-NUM
WHERE
EMP_NAME = 'AnuB'
END-EXEC

Here suppose the employee phone number in the database may have null values as well.

Now what will be the SQL code.
will it be successful? The Answer is NO. It will show negative SQL code.


Because the Null value from the database can't be assigned to the host variable. And your program will abend.

So in this case to avoid the sql error we will code the SQL as follows.

EXEC SQL
SELECT
EMP_PHONE_NUM
INTO
:EMP-PHONE-NUM :IND-EMP-PHONE
WHERE
EMP_NAME = 'AnuB'
END-EXEC

In this case the SQL wont get the error. Simply it will set the IND-EMP-PHONE (null indicator) to negative value (say -1 or -2)

Now the sql will be successful. Now you can put one condition to check whether the filed has null value by looking the Null indicator variable.

Regards,
Matty
Back to top
View user's profile Send private message
AnuB
Currently Banned

New User


Joined: 29 Aug 2005
Posts: 35

PostPosted: Tue Aug 30, 2005 12:16 am    Post subject: Re:Null Identifier
Reply with quote

Thank u .
Back to top
View user's profile Send private message
ajayvamsi
Currently Banned

New User


Joined: 21 Jul 2005
Posts: 56
Location: Hyderabad

PostPosted: Fri Sep 09, 2005 10:51 pm    Post subject:
Reply with quote

hey abu
Declare the variable for null indicator as S9(04) COMP.
Thanks..!! Bye
Back to top
View user's profile Send private message
Anbudan

New User


Joined: 07 Sep 2005
Posts: 26
Location: Germany

PostPosted: Tue Sep 13, 2005 6:13 pm    Post subject:
Reply with quote

Hi AnuB

To find out, whether the field is NULL or NOT NULL,

i)Check the Table info on DB2 OR
ii)While Create DCLGEN, u will find.



Don't hesitate to ask




Anbudan
Back to top
View user's profile Send private message
AnuB
Currently Banned

New User


Joined: 29 Aug 2005
Posts: 35

PostPosted: Tue Sep 13, 2005 7:34 pm    Post subject: Thanks
Reply with quote

Thank u all.
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 Fileaid Update Replace with null string descann Compuware & Other Tools 4 Mon May 15, 2017 3:00 pm
No new posts VALIDATE NULL VALUE IN DB2 CASE STATE... useit DB2 5 Thu Feb 09, 2017 4:34 pm
No new posts Syncsort - NULL in Integer field chec... nartcr SYNCSORT 4 Thu Oct 06, 2016 6:47 am
No new posts Converting NULL column into NOT NULL ... Raghu navaikulam DB2 5 Sat Aug 06, 2016 3:45 pm
No new posts GetObjectArrayElement returns NULL Majid Hussain Java & MQSeries 2 Wed Mar 30, 2016 2:59 am


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