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
 

 

UNUSABLE HOST VARIABLE

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

New User


Joined: 14 Jun 2012
Posts: 70
Location: India

PostPosted: Wed Jan 15, 2014 1:02 pm    Post subject: UNUSABLE HOST VARIABLE
Reply with quote

Hi All,

I have the below query.

EXEC SQL
SELECT (DATE(:WS-DATE) - :WS-DAYS DAYS)
INTO :WS-TEMP-DATE
FROM SYSIBM.SYSDUMMY1
END-EXEC

I am getting pre compile error for the above as
UNDEFINED OR UNUSABLE HOST VARIABLE "WS-DAYS"

I have defined WS-DAYS in 01 level as 9(01).

Am I missing something?
Back to top
View user's profile Send private message

pshongal

New User


Joined: 14 Jun 2012
Posts: 70
Location: India

PostPosted: Wed Jan 15, 2014 1:13 pm    Post subject:
Reply with quote

Got it... WS-DAYS should be X(01)
Back to top
View user's profile Send private message
sureshpathi10

Active User


Joined: 03 May 2010
Posts: 154
Location: Kuala Lumpur

PostPosted: Wed Jan 15, 2014 1:27 pm    Post subject:
Reply with quote

Could you post your result if possible?

I was thinking all integer used in the SQL should be declared as PIC S9(9) USAGE COMP.
Back to top
View user's profile Send private message
sureshpathi10

Active User


Joined: 03 May 2010
Posts: 154
Location: Kuala Lumpur

PostPosted: Wed Jan 15, 2014 1:41 pm    Post subject:
Reply with quote

if you just want to subtract some days from the date, you may use this code as your alternative.

Code:
 
01 WS-TEMP-DATE            PIC 9(08).
01 WS-DATE                 PIC 9(08) VALUE 20140115.
01 WS-DAYS                 PIC 9(01) VALUE 5.

COMPUTE WS-TEMP-DATE = FUNCTION DATE-OF-INTEGER (
           FUNCTION INTEGER-OF-DATE(WS-DATE) - WS-DAYS)


WS-TEMP-DATE value would be 20140110.
Back to top
View user's profile Send private message
pshongal

New User


Joined: 14 Jun 2012
Posts: 70
Location: India

PostPosted: Wed Jan 15, 2014 4:34 pm    Post subject:
Reply with quote

Thanks a lot Suresh...
Yes that's right. I had to change it back to S9(04) Comp.

Let me also try the code you have given.
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 Format to pipe delimited with variabl... pshongal SYNCSORT 6 Wed Sep 14, 2016 2:48 pm
No new posts Variable for cursor names ravikumar15 DB2 5 Sun Jul 17, 2016 7:08 am
No new posts OPC JCL Variable passion_sujesh IBM Tools 5 Fri Jul 01, 2016 4:21 am
No new posts JOINKEYs and Variable files migusd SYNCSORT 8 Fri Jun 17, 2016 3:16 am
No new posts PC to Host for unicode file Tom Steiner TSO/ISPF 5 Mon May 16, 2016 10:38 pm


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