• Subject: Questions on CONVERT-DATE-TIME and ADD-DURATION
  • From: "Robert E. Burger" <rburger@xxxxxxxx>
  • Date: Sun, 27 Feb 2000 01:19:39 -0600

I am attempting to use the date/time intrinsics under ILE COBOL and am having a 
problem that is really baffling me.  The
following program bombs at the MOVE FUNCTION CONVERT-DATE-TIME
line with the following run-time messages:

Data format error.
The contents of date-time item does not match its format.
Function check. LNR7093 unmonitored by DATETIME at statement 0000000019,
  instruction X'0000'.

My understanding is that CONVERT-TIME-DATE should be able to take the string 
returned by CURRENT-DATE and convert it into either
a DATE, TIME or TIMESTAMP type variable which ADD-DURATION can then use to do 
date arithmetic.  No matter which type I select, I
get the same errors.

Sample code follows:

       IDENTIFICATION DIVISION.
       PROGRAM-ID.    DATETIME.
       AUTHOR.        ROBERT BURGER.
      *
      * CHANGE HISTORY:
      *
      *   DATE   WHO CHANGE
      * -------- --- --------------------------------------------
      *

       ENVIRONMENT DIVISION.
       CONFIGURATION SECTION.

       SOURCE-COMPUTER. IBM-AS400.
       OBJECT-COMPUTER. IBM-AS400.

       INPUT-OUTPUT SECTION.
       FILE-CONTROL.

       DATA DIVISION.
       FILE SECTION.

       WORKING-STORAGE SECTION.

       01 SYSTEM-DATE           PIC X(21).
       01 SYSTEM-TIME           FORMAT TIME.

       LINKAGE SECTION.

       PROCEDURE DIVISION.

       MAIN-PROGRAM SECTION.
       000-MAIN-PROGRAM.

           MOVE FUNCTION CURRENT-DATE TO SYSTEM-DATE.
           DISPLAY SYSTEM-DATE.

           MOVE FUNCTION CONVERT-DATE-TIME (SYSTEM-DATE TIME)
                TO SYSTEM-TIME.
           DISPLAY SYSTEM-TIME.
           DISPLAY FUNCTION ADD-DURATION (SYSTEM-TIME MINUTES 15).

           GOBACK.

Thanks in advance,

Robert E. Burger
Information Systems Coordinator
Tarrant County CSCD
Fort Worth, Texas, USA
=============================
AS/400 9406-620 running OS/400 V4R4
AS/400 9406-170 running OS/400 V4R4


+---
| This is the COBOL/400 Mailing List!
| To submit a new message, send your mail to COBOL400-L@midrange.com.
| To subscribe to this list send email to COBOL400-L-SUB@midrange.com.
| To unsubscribe from this list send email to COBOL400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---END



As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2022 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.