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
 
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: 78
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: 78
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: 78
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 Move from Comp3 variable to Edited Va... Revathy.nair0485 COBOL Programming 7 Fri Nov 03, 2017 3:30 pm
This topic is locked: you cannot edit posts or make replies. Can a alphanumeric data be moved to a... nico_neoz COBOL Programming 10 Mon Oct 30, 2017 8:28 am
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

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