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



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






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.