× 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.



If you have never worked with Service Programs, this is a worthwhile
endeavor. I would encourage you to follow through. IF development time is
critical, you can get this with embedded SQL

dcl-s theDate dec(8:0) ;
dcl-s RtnDay char(10) ;

Select dayname(date(substr(digits(:theDate),1,4)||'-'||
substr(digits(:theDate),5,2)||'-'||
substr(digits(:theDate),7,2))) into
:RtnDay
from sysibm.sysdummy1 ;

This will return the character name (Monday, etc). If you want the number
of the day of week, change DAYNAME to DAYOFWEEK.

IF you want this to be reusable, you can put it in a User Defined Function
for repeated use ....

CREATE or REPLACE Function *Library*.GetTheDay
(@Date decimal(8,0))
Returns char(10)
LANGUAGE SQL
Is Deterministic
Reads SQL Data
Set Option Commit=*None, UsrPrf=*Owner, DatFmt=*USA
Begin

Declare @RtnDay char(10) ;

Select dayname(date(substr(digits(@Date),1,4)||'-'||
substr(digits(@Date),5,2)||'-'||
substr(digits(@Date),7,2))) into @RtnDay
from sysibm.sysdummy1 ;

Return @RtnDay ;
end ;

Embedded sql would then be ...

Select GetTheDay(:theDate) into :RtnDay from sysibm.sysdummy1 ;

Hopefully I did not mess up the syntax copying/pasting, but you will get
the idea. Good luck.








On Tue, Sep 3, 2019 at 9:31 AM Robert Jacobs <robertjacobsit@xxxxxxxxx>
wrote:

And in the locations where you see GENTOOLS, please change to DTTOOLS. My
apologies. My butchering wasn't as precise as I'd hoped (again, my toolkit
is a general kit with many functions, not just dates, hence, the name
change).

On Tue, Sep 3, 2019 at 6:11 AM Gad Miron <gadmiron@xxxxxxxxx> wrote:

Hello Guys

I need to create a callable PGM that accept a date parameter (YYYYMMDD)
and returns a DayOfWeek parameter

I've created a free format PGM alright (with Pr and PI) but I'm
stymied with making
a no-Cycle version.

I've read that using a clt- option *NOMAIN is for a Module only.

Is it possible to write such a (no cycle) program and compile it with
CRTBNDRPG in one pass
Or do I have to resort to CRTRPGMOD + CRTPGM ?

TIA
Gad
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com

--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.