× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: SQLRPG/400 Day of Week ?
  • From: MacWheel99@xxxxxxx
  • Date: Tue, 28 Nov 2000 15:17:23 EST

Does SQL's SET DayofWeek Scalar Function work in RPG/400?
If so, what am I doing wrong?

I have been working with RPG/400 but still a bit of a newcomer to SQL.
This week I got the December 2000 News/400 & decided to try out some of the 
tips & those that worked for me were GREAT!  I passed on some of the 
Query/400 tips (like uses for zero width fields) to non-programmer co-workers.
On page 67 there is an article by Mike Cravitz on using SQL's Set Statement.
Well I have several SQLRPG/400 programs which are 90% RPG, but have embedded 
SQL SELECT to get at data base stuff, instead of using chain read etc. which 
I think is real cool - you can get at selected info from many files in one 
SQL input, and just the info you need, not all the other baggage of a file 
record fields not being used.

I selected a program that has lots of white space in front of printing date 
11/27/00 thinking that I would first put Monday in front of that, then in 
some later program go after what day of week is associated with historical 
dates like when some shipment was made.

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

I put cursor on error message & F1
A syntax error was detected
Token : is not a valid token
Syntax seems correct up to that point

Well I use that exact symbol in my SELECT lines that compile & in fact I got 
this code by cut & paste from such a program then keyed over top to make the 
code look like the ILE example in the article, so if colon is invalid it is 
invalid with SET or I have a spacing problem

Assuming this should work in SQLRPG/400, I figure that I may have a 
punctuation error, but not being an SQL guru, I cannot see it.

MacWheel99@aol.com (Alister Wm Macintyre) (Al Mac)
AS/400 Data Manager & Programmer for BPCS 405 CD Rel-02 mixed mode (twinax 
interactive & batch) @ http://www.cen-elec.com Central Industries of 
Indiana--->Quality manufacturer of wire harnesses and electrical 
sub-assemblies - fax # 812-424-6838

+---
| 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
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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

This mailing list archive is Copyright 1997-2024 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].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.