TIRFDAY

TIRFDAY is a called module supplied with CA Gen. TIRFDAY is called every time an action diagram uses the DAY function.

DAY extracts the day part of a valid date. The numeric value returned will be a number between 1 and 31 inclusive.

DAY generates the following COBOL statements:

Statement

Quantity

Call

1

Compute

2

Move

2

Initialize

1

IF

1

Heavy use of DAY can drastically increase CPU costs.

Hints

If an action diagram uses DAY more than once for the same date:

  • use DAY once for the desired date

  • save the day returned in a local view

  • use the local view instead of DAY for the remaining instances

  • pass the local view to the import view of any called action diagrams that need it.

If DAY is used in an action diagram that uses several CA Gen functions, or the action diagram has high CPU usage due to DAY, consider converting the action diagram to an external action block.

Example (COBOL External Action Block)

In this example, only two COBOL statements are needed to extract the day part of a date into a numeric value.

WORKING-STORAGE SECTION.

01 WS-FIELDS.

03 WS-DATE PIC 9(08).

03 WS-DATE-X REDEFINES WS-DATE.

05 WS-DATE-CENTURY PIC 9(02).

05 WS-DATE-YEAR PIC 9(02).

05 WS-DATE-MONTH PIC 9(02).

05 WS-DATE-DAY PIC 9(02).

LINKAGE SECTION.

01 IMPORT-0001EV.

03 WORK-VIEW-0001ET.

05 DATE-FLD1-0001AS PIC X(0001).

05 DATE-FLD1-0001 PIC S9(0008).

05 DATE-FLD1-0001XX REDEFINES DATE-FLD1-0001

PIC X(0008).

01 EXPORT-0002EV.

03 WORK-VIEW-0002ET.

05 INTEGER-FLD1-0002AS PIC X(0001).

05 INTEGER-FLD1-0002 PIC S9(0002).

05 INTEGER-FLD1-0002XX REDEFINES INTEGER-FLD1-0002

PIC X(0002).

PROCEDURE DIVISION.

MOVE DATE-FLD1-0001 TO WS-DATE.

MOVE WS-DATE-DAY TO INTEGER-FLD1-0002.