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

$0.00 Raised:
$