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

Null Identifier


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

New User


Joined: 29 Aug 2005
Posts: 33

PostPosted: Mon Aug 29, 2005 7:07 am
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
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: 33

PostPosted: Tue Aug 30, 2005 12:16 am
Reply with quote

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

New User


Joined: 21 Jul 2005
Posts: 56
Location: Hyderabad

PostPosted: Fri Sep 09, 2005 10:51 pm
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
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: 33

PostPosted: Tue Sep 13, 2005 7:34 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Null values are considered in Total c... DFSORT/ICETOOL 6
No new posts the system or user abend SF0F R=NULL COBOL Programming 0
No new posts Uploading from desktop, a CSV file, s... DB2 2
This topic is locked: you cannot edit posts or make replies. Findrep - an identifier to mark the a... SYNCSORT 17
No new posts How to handle NULL in COBOL program COBOL Programming 8
Search our Forums:

Back to Top