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?

TomH

-----Original Message-----
From: cobol400-l-bounces@xxxxxxxxxxxx
[mailto:cobol400-l-bounces@xxxxxxxxxxxx] On Behalf Of
MichaelQuigley@xxxxxxxxxx
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 -----

To:

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

Subject:

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

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

CRTBNDCBL PGM(IDOCKETGY/CCEXTRACT) +
SRCFILE(IDOCKETGY/QCBLSRC) SRCMBR(*PGM) +
OPTION(*SOURCE) CVTOPT(*DATETIME *DATE) +
DBGVIEW(*ALL)

TomH

--
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,
visit: http://lists.midrange.com/mailman/listinfo/cobol400-l
or email: COBOL400-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at http://archive.midrange.com/cobol400-l.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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

This mailing list archive is Copyright 1997-2021 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.