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
 

 

assign a null value to a host variable

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

New User


Joined: 19 Feb 2005
Posts: 22

PostPosted: Wed Nov 01, 2006 4:17 pm    Post subject: assign a null value to a host variable
Reply with quote

Hi All,
I supposed to assign a null value to a host variable.
I am getting sqlcode of 30n instead of 305
Why this happens?
Back to top
View user's profile Send private message

Yoyoyo

New User


Joined: 19 Sep 2006
Posts: 26

PostPosted: Wed Nov 01, 2006 5:13 pm    Post subject:
Reply with quote

Hey Esaccy,

Quote:
I am getting sqlcode of 30n instead of 305


Let us know whether you got the SQLCODE "30n" or you meant something else!

YoYoYo
Back to top
View user's profile Send private message
ovreddy

Active User


Joined: 06 Dec 2004
Posts: 211
Location: Keane Inc., Minneapolis USA.

PostPosted: Wed Nov 01, 2006 6:41 pm    Post subject:
Reply with quote

Hi,

Move -1 to the indicator variable corresponding to the host variable which you want to make null.

Eg: To make :HV00-COL1 value to null

MOVE -1 TO VHV00COL1

Thanks,
Reddy
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Wed Nov 01, 2006 6:57 pm    Post subject: Re: assign a null value to a host variable
Reply with quote

esaccy,

First, when you display the SQLCODE, move it to a PIC -9(3) field first and then display that. the ?N? in the 30N includes the sign. If you look at the HEX value of ?N? you will find x?D5?, where the ?D? is the ?-? sign.

Second, you cannot assign a null value to a host variable. What you can do is assign a null indicator to a host variable.

SELECT COL_VAR
FROM TABLE
INTO :HOST-COL-VAR:HOST-COL-VAR-IND

Where HOST-COL-VAR is, well, you host variable and HOST-COL-VAR-IND is the host null indicator. It must be defined as a 9(4) COMP field. After you select, a value of 0 (zero) indicated the DB2 col value is NOT null and the host variable contains valid data, and a value of -1 indicates the DB2 value is null and the Host variable does not contain valid data (usually low-values, but not guaranteed)

Dave
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 Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Fileaid Update Replace with null string descann Compuware & Other Tools 4 Mon May 15, 2017 3:00 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Writing on to GSAM variable length rohanthengal JCL & VSAM 6 Fri Mar 03, 2017 7:46 pm
No new posts VALIDATE NULL VALUE IN DB2 CASE STATE... useit DB2 5 Thu Feb 09, 2017 4:34 pm


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