So, dates like '0001-01-01' will cause the error? There are quite a few of
those in the file (we receive the file from a 3rd party).

In RPGLE, I can use the MONITOR function to help catch bad dates; is there
an equivalent in COBOL?


-----Original Message-----
From: cobol400-l-bounces@xxxxxxxxxxxx
[mailto:cobol400-l-bounces@xxxxxxxxxxxx] On Behalf Of
Sent: Friday, November 29, 2013 12:47 PM
To: cobol400-l@xxxxxxxxxxxx
Subject: Re: [COBOL400-L] *ISO date in COBOL?

Check the compile listing to see if the field is being specified as FORMAT

DATE '@Y-%m-%d'. There could also be an entry under special names which
could throw things off. If the format isn't specified with '@Y-%m-%d', the
compiler will treat the dates using the job default--and you cannot set
DATFMT for a job to *ISO (or *USA for that matter).

You may know this, but internally the dates are not stored in a format we
humans would recognize. They are stored as a 10-digit integer. The system
takes care of converting to whatever format is requested at the time. If
you don't specify one, It will default the the job format. At our shop
that's *MDY--perhaps yours is *YMD. In any case, none of the default job
date formats include the 1st of January 0001. Hence, dates as

early as that will cause a data format mapping error.

If the compile listing shows the year portion of the date as something other
than '%y' (lower-case y), then you've got a different problem. an
upper-case Y with either % or @ will work.

cobol400-l-bounces@xxxxxxxxxxxx wrote on 11/28/2013 01:00:03 PM:
----- Message from "Tom Hightower" <tomh@xxxxxxxxxxx> on Wed, 27 Nov
2013 17:55:18 -0600 -----


"'COBOL Programming on the IBM i \(AS/400 and iSeries\)'" <cobol400-


Re: [COBOL400-L] *ISO date in COBOL?

The programmer working on it says that she's doing the compile like so:



This is the COBOL Programming on the IBM i (AS/400 and iSeries)
(COBOL400-L) mailing list
To post a message email: COBOL400-L@xxxxxxxxxxxx To subscribe, unsubscribe,
or change list options,
or email: COBOL400-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at

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-2021 by 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.