Skip to main content

Problem:

Passing a non-recognisable or non-existent date to the INTEGER-OF-DATE intrinsic function returns a value of 0.

Example;

C:\\>type Pro1.cbl

       DATA DIVISION.

       WORKING-STORAGE SECTION.

       01 RET      PIC 9(8).

       PROCEDURE DIVISION.

         MOVE  FUNCTION INTEGER-OF-DATE(20060229) TO RET.

          DISPLAY RET.

        GOBACK.

C:\\>runc Pro1

00000000

Is the function defined to return value 0 for any non-existent date?

Resolution:

Please refer to documentation.

A search for 'intrinsic function' in the Index points to:

'Reference > COBOL Language > Part 2: Program Definition > Procedure Division > Intrinsic Functions'

It mentions that if arguments specified for a function do not have values that comply with specific constraints, then the returned value for the function is undefined.

Old KB# 1381