|
----- Message from "Stone, Joel" <Joel.Stone@xxxxxxxxxx> on Tue, 13something?
Sep 2016 18:22:36 +0000 -----
To:
"'COBOL Programming on the IBM i (AS/400 and iSeries)'" <cobol400-
l@xxxxxxxxxxxx>
Subject:
[COBOL400-L] COBOL: getting the current date into am *ISO db field
ILE Cobol v7r1
Trying to learn all about date data types and cobol. I can see why
many use the old YYYYMMDD pic x(8) in their db fields!!
Is it possible to acquire the current date AND move it into a db
field in one step? It doesn't seem to be possible; am I missing
DTDUE-DT is defined as *ISO in the db (is there a better choice?)
Using *DATETIME and *DATE as compiler options, the COBOL compiler
data definition sees it as:
06 DTDUE-DT FORMAT DATE '@Y-%m-%d'.
DUE DT
(Date field)
MOVE FUNCTION CURRENT-DATE to DTDUE-DT
Seems to fail; ie it refuses to acknowledge the separators.
Executing the statement at noon today, DTDUE-DT is set to 2016090312
Where the ending "12" is the hours.
I have tried
MOVE FUNCTION CURRENT-DATE ('@Y-%m-%d) to DTDUE-DT
And also
MOVE FUNCTION CURRENT-DATE to DTDUE-DT ('@Y-%m-%d)
But those don't get past the editor :(
Shouldn't COBOL be smart enough to add the date separators "-" if
the target field is defined with them??
Thanks in advance!
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.