|
My array is in the procedure itself. I don't use compile-time data. Look at the code. Bob -----Original Message----- From: rpg400-l-admin@midrange.com [mailto:rpg400-l-admin@midrange.com] On Behalf Of alan shore Sent: Wednesday, August 21, 2002 10:07 AM To: rpg400-l@midrange.com Subject: Re: Dear all, Thanks for the reply, and thats how I coded it previously, but where in the module is the array placed. I placed it at the end (after line 64) and that resulted in errors when I attempted to create the module. >>> "Booth Martin" <Booth@MartinVT.com> 08/21/02 11:01AM >>> -- -- [ Picked text/plain from multipart/alternative ] DARD S 9A DIM(7) PERRCD(7) CTDATA ** DAYS of the week: (becomes "WeekDay") (ARD Day-of-week) Sunday Monday Tuesday WednesdayThursday Friday Saturday ---------------------------------------------------------Booth Martin http://www.MartinVT.com Booth@MartinVT.com --------------------------------------------------------- -------Original Message------- From: rpg400-l@midrange.com Date: Wednesday, August 21, 2002 10:38:09 To: \"'rpg400-l@midrange.com'\ Subject: Dear all, Dear all, I came across an article by Robert Cozzi, Jr at http://www.mcpressonline.com/mc/.5bfbb72f titled "Moving to ILE CL" (and before anyone starts saying that I'm in the wrong forum, this is an RPG question) I decided it was high time for me to start delving into creating procedures, and binding and such. Plus the end result of this article would give me the day of the week for a particular date, which is something that I need for a project I'm working on. So - killing 2 birds with one stone. Anyway, in the article/procedures/programs, what is returned is a numeric value representing the day of the week. What I want ot return is the actual English representation. Monday, Tuesday etc. I attempted to implement arrays, but ended up with not being able to create a module due to compile errors. My question to the forum, how can arrays be implemented in rpg procedures, if possible. I have included the RPG module that I ended up with, and it should be apparent what array I am attempting to implement. Much appreciated and thanks in advance. *************** Beginning of data ************************************* 0001.00 H NOMAIN 0002.00 *---------------------------------------------------------------- 0003.00 * GetWeekDay - Calculate the day of the week from a CL format date 0004.00 * 0005.00 *---------------------------------------------------------------- 0006.00 D GetWeekDay PR 10a 0007.00 D cymdDate 7A CONST 0008.00 0009.00 P GetWeekDay B Export 0010.00 * DAYOFWEEK 0011.00 D GetWeekDay PI 10A 0012.00 D cymdDate 7A CONST 0013.00 * * 0014.00 D BaseDate S D DATFMT(*ISO) INZ(D'1582-10-14') 0015.00 D Days S 10I 0 0016.00 D DayofWeek S 10I 0 0017.00 D DayofWeekAlpha S 1A 0018.00 D WeekDay S 10A 0019.00 D InputDate S D DATFMT(*ISO) 0020.00 * 0021.00 *---------------------------------------------------------------- 0022.00 C *CYMD0 TEST(DE) cymdDate 0023.00 C If %ERROR 0024.00 C return 'Invalid ' 0025.00 C endif 0026.00 C *CYMD0 MOVE cymdDate InputDate 0027.00 C InputDate Subdur BaseDate Days:*Days 0028.00 C CALLB 'CEEDYWK' 0029.00 C PARM Days 0030.00 C PARM DayofWeek 0031.00 C DayofWeek dsply 0032.00 C if DayofWeek=1 0033.00 C eval Weekday='Sunday ' 0034.00 C else 0035.00 C if DayofWeek=2 0036.00 C eval Weekday='Monday ' 0037.00 C else 0038.00 C if DayofWeek=3 0039.00 C eval Weekday='Tuesday ' 0040.00 C else 0041.00 C if DayofWeek=4 0042.00 C eval Weekday='Wednesday' 0043.00 C else 0044.00 C if DayofWeek=5 0045.00 C eval Weekday='Thursday ' 0046.00 C else 0047.00 C if DayofWeek=6 0048.00 C eval Weekday='Friday ' 0049.00 C else 0050.00 C if DayofWeek=7 0051.00 C eval Weekday='Saturday ' 0052.00 C else 0053.00 C eval WeekDay='Invalid ' 0054.00 C endif 0055.00 C endif 0056.00 C endif 0057.00 C endif 0058.00 C endif 0059.00 C endif 0060.00 C endif 0061.00 C WeekDay dsply 0062.00 * * 0063.00 C Return WeekDay 0064.00 P GetWeekDay E _______________________________________________ This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l or email: RPG400-L-request@midrange.com Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l. . -- [ Content of type image/gif deleted ] -- _______________________________________________ This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l or email: RPG400-L-request@midrange.com Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l. _______________________________________________ This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l or email: RPG400-L-request@midrange.com Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.
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.