• Subject: Re: SQLRPG/400 Day of Week ?
  • From: Pete Hall <pbhall@xxxxxxxxxx>
  • Date: Tue, 28 Nov 2000 19:30:37 -0600

At 14:17 11/28/2000, Al Mac wrote:
>Does SQL's SET DayofWeek Scalar Function work in RPG/400?
>If so, what am I doing wrong?
>C MOVEL *DATE TODAY 8.0
>& I also defined WKDAY as 1.0
>
>C/EXEC SQL
>C+ SET :WKDAY = DayOfWeek(:TODAY)
>C/END-EXEC
>
>Error message from SEU
>Token : was not valid.  Valid Tokens: OPTION RESULT CONNECTION TRANSACTION

SET isn't valid for a host variable. Try using a VALUES INTO statement. 
I've never used it, but the documentation says "The VALUES INTO statement 
produces a result table consisting of at most one row and assigns the 
values in that row to host variables." You'd need an expression something like:

   C/EXEC SQL VALUES DayOfWeek(:TODAY) INTO :WKDAY
   C/END-EXEC

hth
Pete
Pete Hall
pbhall@execpc.com
http://www.execpc.com/~pbhall/

+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].