|
We use the following format using 2 fields with ILE COBOL: 01 WS-CUR-DATE PIC 9(8). 01 REDEFINES WS-CUR-DATE. 05 CC PIC 99. 05 YY PIC 99. 05 MM PIC 99. 05 DD PIC 99. 01 WS-CUR-TIME PIC 9(8). 01 REDEFINES WS-CUR-TIME. 05 HH PIC 99. 05 MN PIC 99. 05 SS PIC 99. 05 SS-DEC PIC 99. ACCEPT WS-CUR-CCYYMMDD FROM DATE YYYYMMDD. ACCEPT WS-CUR-TYME FROM TIME. Michael Kamergorodsky -----Original Message----- From: Robert E. Burger [mailto:rburger@home.net] Sent: Sunday, February 27, 2000 2:20 AM To: cobol400-L@midrange.com Subject: Questions on CONVERT-DATE-TIME and ADD-DURATION 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 +--- | 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 mailing list archive is Copyright 1997-2024 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.