Joel, To do a similar thing I used the 'Common Execution Environment' API's. I had to come up with the day of the week number 1/7, Sunday being 1.
Here's how I did it. Most likely a little lengthy but effective. In a COBOL ILE program also.
All came from IBM's manual explaining some of the CEE api's. I didn't find a similar ILE function. There may be one, I just haven't found it.
ALL DEVELOPMENT CREDIT GOES TO IBM. I just had to make it go. IBM did a very good job here.
Good luck. mh

SPECIAL-NAMES.
** CEExxxx API's from the Common Execution Environment
** Special-Names API Calls for Day-of-week
LINKAGE TYPE PROCEDURE FOR 'CEEDAYS' USING ALL DESCRIBED
LINKAGE TYPE PROCEDURE FOR 'CEEDYWK' USING ALL DESCRIBED
** Special-Names I-O Feedback
I-O-FEEDBACK IS PNL-FEEDBACK.

WORKING-STORAGE SECTION.
01 WSCCEEDATES.
05 WSCLILIAN-DATE PIC S9(09) BINARY.
05 WSCDOW-NUM PIC S9(09) BINARY.
05 WSCDOW-TXT PIC X(10).
05 WSCDOW-FMT PIC X(10) VALUE 'Wwwwwwwwwz'.
05 WSCSAMPLE-DATE PIC X(08).
05 WSCDATE-FORMAT PIC X(08).

01 WSCDATA.
05 WSCDAYSTBL.
10 FILLER PIC X(09) VALUE 'Sunday '.
10 FILLER PIC X(09) VALUE 'Monday '.
10 FILLER PIC X(09) VALUE 'Tuesday '.
10 FILLER PIC X(09) VALUE 'Wednesday'.
10 FILLER PIC X(09) VALUE 'Thursday '.
10 FILLER PIC X(09) VALUE 'Friday ! '.
10 FILLER PIC X(09) VALUE 'Saturday '.
05 WSCDAYS REDEFINES WSCDAYSTBL.
10 WSCDOW PIC X(09) OCCURS 07 TIMES
INDEXED BY WSC1.

PROCEDURE DIVISION.
MOVE YOUR-DATE-FIELD (as yyyymmdd) TO WSCSAMPLE-DATE
MOVE 'YYYYMMDD' TO WSCDATE-FORMAT
PERFORM 100-CEE THRU 100-EXIT
MOVE WSCDOW-NUM TO MYDOWFIELD
SET WSC1 TO MYDOWFIELD
MOVE WSCDOW (WSC1) TO MAPDAYFIELD

100-CEE.
CALL 'CEEDAYS' USING WSCSAMPLE-DATE
WSCDATE-FORMAT
WSCLILIAN-DATE
OMITTED.

CALL 'CEEDYWK' USING WSCLILIAN-DATE
WSCDOW-NUM
OMITTED.
100-EXIT.
EXIT.


MH

-----Original Message-----
From: cobol400-l-bounces@xxxxxxxxxxxx [mailto:cobol400-l-bounces@xxxxxxxxxxxx] On Behalf Of cobol400-l-request@xxxxxxxxxxxx
Sent: Wednesday, May 02, 2012 1:00 PM
To: cobol400-l@xxxxxxxxxxxx
Subject: COBOL400-L Digest, Vol 10, Issue 8

Send COBOL400-L mailing list submissions to
cobol400-l@xxxxxxxxxxxx

To subscribe or unsubscribe via the World Wide Web, visit
http://lists.midrange.com/mailman/listinfo/cobol400-l
or, via email, send a message with subject or body 'help' to
cobol400-l-request@xxxxxxxxxxxx

You can reach the person managing the list at
cobol400-l-owner@xxxxxxxxxxxx

When replying, please edit your Subject line so it is more specific than "Re: Contents of COBOL400-L digest..."


Today's Topics:

1. COBOL user-defined functions (Stone, Joel)
2. Re: COBOL user-defined functions (Jon Paris)


----------------------------------------------------------------------

message: 1
date: Tue, 1 May 2012 18:38:32 +0000
from: "Stone, Joel" <Joel.Stone@xxxxxxxxxx>
subject: [COBOL400-L] COBOL user-defined functions

Does COBOL/400 or COBOL /ILE support user-defined functions in any fashion (like RPG and all other modern languages)?



For example,



Move DayOfWeek(Date-input) to print-line



Where DayOfWeek is a user-defined function returning "Monday" or "Tuesday" or etc.



If not, any idea why not?



Thanks!


______________________________________________________________________
This outbound email has been scanned for all viruses by the MessageLabs Skyscan service.
For more information please visit http://www.symanteccloud.com ______________________________________________________________________

------------------------------

message: 2
date: Tue, 1 May 2012 15:08:48 -0400
from: Jon Paris <jon.paris@xxxxxxxxxxxxxx>
subject: Re: [COBOL400-L] COBOL user-defined functions

Already answered on Midrange list

On 2012-05-01, at 2:38 PM, Stone, Joel wrote:

Does COBOL/400 or COBOL /ILE support user-defined functions in any fashion (like RPG and all other modern languages)?



For example,



Move DayOfWeek(Date-input) to print-line



Where DayOfWeek is a user-defined function returning "Monday" or "Tuesday" or etc.



If not, any idea why not?



Thanks!


______________________________________________________________________
This outbound email has been scanned for all viruses by the MessageLabs Skyscan service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________
--
This is the COBOL Programming on the iSeries/AS400 (COBOL400-L)
mailing list To post a message email: COBOL400-L@xxxxxxxxxxxx To
subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/cobol400-l
or email: COBOL400-L-request@xxxxxxxxxxxx Before posting, please take
a moment to review the archives at
http://archive.midrange.com/cobol400-l.

Jon Paris

www.partner400.com
www.SystemiDeveloper.com






------------------------------

--
This is the COBOL Programming on the iSeries/AS400 (COBOL400-L) digest list To post a message email: COBOL400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/cobol400-l
or email: COBOL400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/cobol400-l.



End of COBOL400-L Digest, Vol 10, Issue 8
*****************************************

Under Florida law, e-mail addresses are public records. If you do not want your e-mail address released in response to a public-records request, do not send electronic mail to this entity. Instead, contact this office by phone or in writing. The information contained in this email and/or attachment(s) may be confidential and intended solely for the use of the individual or entity to which it is addressed. This email and/or attachment(s) may contain material that is privileged or protected from disclosure under applicable law. If you are not the intended recipient or the individual responsible for delivering to the intended recipient, please notify sender immediately by telephone to obtain instructions as to whether information in this email and/or attachment(s) is confidential and privileged or protected from disclosure under applicable law.

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