Date host-variable getting -310

Gary Fahrlander

Date host-variable getting -310
Client has requested number of days input parameter to cobol program.
Program needs to then select a low and high date from sysibm.sysdummy1. I
can get the following SQL to work:

SELECT DATE(CURRENT DATE - (30) DAYS)
,DATE(CURRENT-DATE - (60) DAYS)
FROM SYSIBM.SYSDUMMY1

I've read the manuals and searched the listserv but have not been able to
hit upon the correct cobol host variable definition for the number of days
for the following query to work:

SELECT DATE(CURRENT DATE - (:HV-LO-DATE) DAYS)
,DATE(CURRENT-DATE - (:HV-HI-DATE) DAYS)
FROM SYSIBM.SYSDUMMY1

Thanks in advance.



John McKown

Re: Date host-variable getting -310
(in response to Gary Fahrlander)
Why not simply use COBOL's date routines? You can use INTEGER-OF-DATE to
convert a Gregorian date from YYYYMMDD into an integer. Do that for both
dates, then subtract. You can use the CURRENT-DATE function to get today's
date. Or use a statement similar to

ACCEPT TODAYS-DATE FROM DATE YYYYMMDD.

77 TODAYS-DATE PIC 9(8).


. Look in the COBOL for OS/390 Language Reference manual. SC26-9046.

> -----Original Message-----
> From: Gary Fahrlander [SMTP:[login to unmask email]
> Sent: Tuesday, December 18, 2001 2:25 PM
> To: [login to unmask email]
> Subject: Date host-variable getting -310
>
> Client has requested number of days input parameter to cobol program.
> Program needs to then select a low and high date from sysibm.sysdummy1. I
> can get the following SQL to work:
>
> SELECT DATE(CURRENT DATE - (30) DAYS)
> ,DATE(CURRENT-DATE - (60) DAYS)
> FROM SYSIBM.SYSDUMMY1
>
> I've read the manuals and searched the listserv but have not been able to
> hit upon the correct cobol host variable definition for the number of days
> for the following query to work:
>
> SELECT DATE(CURRENT DATE - (:HV-LO-DATE) DAYS)
> ,DATE(CURRENT-DATE - (:HV-HI-DATE) DAYS)
> FROM SYSIBM.SYSDUMMY1
>
> Thanks in advance.
>
>
>
>
>



Bayard Tysor

Re: Date host-variable getting -310
(in response to John McKown)
Gary,

Is the number of days (i.e. :HV-LO-DATE & :HV-HI-DATE)
declared as a numeric data type, preferably dec(15,0)
or I believe that would be PIC S9(15)V USAGE COMP-3 in
cobol?

Tink

--- Gary Fahrlander <[login to unmask email]>
wrote:
> Client has requested number of days input parameter
> to cobol program.
> Program needs to then select a low and high date
> from sysibm.sysdummy1. I
> can get the following SQL to work:
>
> SELECT DATE(CURRENT DATE - (30) DAYS)
> ,DATE(CURRENT-DATE - (60) DAYS)
> FROM SYSIBM.SYSDUMMY1
>
> I've read the manuals and searched the listserv but
> have not been able to
> hit upon the correct cobol host variable definition
> for the number of days
> for the following query to work:
>
> SELECT DATE(CURRENT DATE - (:HV-LO-DATE) DAYS)
> ,DATE(CURRENT-DATE - (:HV-HI-DATE) DAYS)
> FROM SYSIBM.SYSDUMMY1
>
> Thanks in advance.
>
>
> To change your subscription options or to cancel
> your subscription visit the DB2-L webpage at
> http://www.ryci.com/db2-l. The owners of the list
> can


=====
B.L. "Tink" Tysor
Bayard Lee Tysor, Inc
(401)965-2688
www.BLTysor.com

__________________________________________________
Do You Yahoo!?
Check out Yahoo! Shopping and Yahoo! Auctions for all of
your unique holiday gifts! Buy at http://shopping.yahoo.com
or bid at http://auctions.yahoo.com