MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

DSNH312I Error

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
prabhutp
Beginner


Joined: 02 Feb 2005
Posts: 20
Topics: 11

PostPosted: Mon May 30, 2005 4:38 am    Post subject: DSNH312I Error Reply with quote

Hi

I have query in my cobol,DB2 program as

Exec SQL
SET :WS-EXP-DT = CURRENT DATE + :WS-RETENTION-PD DAYS
End-Exec

I have declared the variables as

03 WS-EXP-DT PIC X(10) VALUE SPACES.
03 WS-RETENTION-PD PIC 9(04) VALUE ZEROES.

But the error message I receive in compilation is DSNH312I - Undefined or unusable Host variable WS-RETENTION-PD.

Kindly help
_________________
tp
Back to top
View user's profile Send private message
acevedo
Beginner


Joined: 03 Dec 2002
Posts: 127
Topics: 0
Location: Europe

PostPosted: Mon May 30, 2005 8:59 am    Post subject: Reply with quote

try

03 ws-retention-pd pic s9(07) comp-3 value zeroes.

hth
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Mon May 30, 2005 3:01 pm    Post subject: Reply with quote

prabhutp,

you simply define

Code:

03 WS-RETENTION-PD PIC S9(04) COMP VALUE ZEROES.


acevedo's solution will work fine, but why waste another additional byte, just define it as 2 bytes


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
prabhutp
Beginner


Joined: 02 Feb 2005
Posts: 20
Topics: 11

PostPosted: Wed Jun 01, 2005 12:03 am    Post subject: Reply with quote

Thanks for the reply..It worked..But,can you please explain the funda behind it.I thought COMP is primarily for storage purpose.

Kindly explain
_________________
tp
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Wed Jun 01, 2005 8:42 am    Post subject: Reply with quote

prabhutp,

Days function in DB2 returns a integer representation of a date. so you need to declare your variable to compatible to it.

Check this link for a detailed explanation of Determining compatibility of SQL and COBOL data types

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DSNAPH11/2.4.3.8?SHELF=&DT=20010710165542&CASE=

Hope this helps...

Cheers

kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group