TIRFNUMD

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

DATENUM converts a numeric value into a valid date. One common use of DATENUM is to set a Db2 date field to its initialized value of '0001-01-01.

DATENUM generates the following COBOL statements:

Statement

Quantity

Call

1

Compute

2

Move

2

Initialize

1

IF

1

Heavy use of DATENUM can drastically increase CPU costs.

Example

The following example sets a Db2 field to its initialized value of '0001-01-01.

 

CREATE employee

SET social_security_number TO import employee social_security_number

SET termination_date TO datenum(00010101)

WHEN successful

Hints

If DATENUM used more than once in an action diagram for the same numeric value:

  • use DATENUM once for the desired numeric value

  • save the date returned in a local view

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

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

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

Example (COBOL External Action Block)

In this example, only one COBOL statement is needed to convert a numeric value into a valid date.

LINKAGE SECTION.

01 IMPORT-0001EV.

03 WORK-VIEW-0001ET.

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

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

05 INTEGER-FLD1-0001XX REDEFINES INTEGER-FLD1-0001

PIC X(0008).

01 EXPORT-0002EV.

03 WORK-VIEW-0002ET.

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

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

05 DATE-FLD1-0002XX REDEFINES DATE-FLD1-0002

PIC X(0008).

PROCEDURE DIVISION.

MOVE INTEGER-FLD1-0001 TO DATE-FLD1-0002.