× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



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 something?

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 thread ...


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

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.