TIRFHRTS

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

HOURTIMESTAMP extracts the hour part of a timestamp. The numeric value returned will be a number between 0 and 24 inclusive.

HOURTIMESTAMP generates the following COBOL statements:

Statement

Quantity

Call

1

Compute

2

Move

2

Initialize

1

IF

1

Heavy use of HOURTIMESTAMP can drastically increase CPU costs.

Hints

If an action diagram uses HOURSTIMESTAMP more than once for the same timestamp:

  • use HOURTIMESTAMP once for the desired timestamp

  • save the hour returned in a local view

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

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

If HOURTIMESTAMP is used in an action diagram that uses several CA Gen functions, or the action diagram has high CPU usage due to HOURTIMESTAMP, 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 hour part of a timestamp into a numeric value.

WORKING-STORAGE SECTION.

01 WS-FIELDS.

03 WS-TIME PIC 9(12).

03 WS-TIME-X REDEFINES WS-TIME.

05 WS-TIME-HOUR PIC 9(02).

05 WS-TIME-MINUTE PIC 9(02).

05 WS-TIME-SECOND PIC 9(02).

05 WS-TIME-MICROSECOND PIC 9(06).

LINKAGE SECTION.

01 IMPORT-0001EV.

03 WORK-VIEW-0001ET.

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

05 TIMESTAMP-FLD1-0001.

07 FILLER-ZERO-DATE PIC 9(0008).

07 FILLER-ZERO-TIME PIC 9(0012).

05 TIMESTAMP-FLD1-0001XX REDEFINES TIMESTAMP-FLD1-0001

PIC X(0020).

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 FILLER-ZERO-TIME TO WS-TIME.

MOVE WS-TIME-HOUR TO INTEGER-FLD1-0002.