Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 DB2 NULL Values display V S Amarendra Reddy DB2 3 Thu Sep 07, 2017 6:59 pm
No new posts Moving values to a variable of copybo... Vignesh Sid COBOL Programming 6 Wed Sep 06, 2017 1:04 pm
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm
No new posts Move from Comp3 variable to Edited Va... sreekusr COBOL Programming 8 Thu Aug 10, 2017 4:20 pm
No new posts Can I traverse a STEM variable? chong.zhou CLIST & REXX 5 Wed May 31, 2017 3:54 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us