TechTalk: Use REXX to retrieve the day of the week.

General
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

In "Day of Week Calculation" (TechTalk, MC, September 1995), a CL program was used to determine the day of the week. I would like to suggest a quicker and easier approach to determining the actual day of the week. Use REXX! 3 shows an example of how it can be done. The first statement retrieves the current day of the week. The second statement uses the parse instruction to convert the day of the week to upper case. The last statement executes a CL command to place the day of the week value into a data area called DAYOFWEEK.

In "Day of Week Calculation" (TechTalk, MC, September 1995), a CL program was used to determine the day of the week. I would like to suggest a quicker and easier approach to determining the actual day of the week. Use REXX! Figure 3 shows an example of how it can be done. The first statement retrieves the current day of the week. The second statement uses the parse instruction to convert the day of the week to upper case. The last statement executes a CL command to place the day of the week value into a data area called DAYOFWEEK.

Just be sure you create this data area before running the procedure. After you create the data area, you can run the REXX procedure from within a CL program and retrieve the day of the week from the data area. An example of this technique is shown in 4.

Just be sure you create this data area before running the procedure. After you create the data area, you can run the REXX procedure from within a CL program and retrieve the day of the week from the data area. An example of this technique is shown in Figure 4.

- Darren Molitor


TechTalk: Use REXX to retrieve the day of the week.

Figure 3: REXX Procedure to Retrieve the Day of the Week

 wd = date('W') parse upper var wd wd 'CHGDTAARA DTAARA(DAYOFWEEK) VALUE(&wd)' 
TechTalk: Use REXX to retrieve the day of the week.

Figure 4: Example CL Program Using Day of Week REXX Procedure

 PGM DCL VAR(&DAYOFWEEK) TYPE(*CHAR) LEN(10) STRREXPRC SRCMBR(DOW001RX) RTVDTAARA DTAARA(DAYOFWEEK) RTNVAR(&DAYOFWEEK) IF (&DAYOFWEEK *EQ 'MONDAY') THEN(DO) . . . ENDDO IF (&DAYOFWEEK *EQ 'TUESDAY') THEN(DO) . . . ENDDO ENDPGM 
BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  •  

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: