Wow - thank you so much.

This is SOOOO much simpler and easier to use and makes sense.

And works perfectly.

I am already using a work field for the date math - I didn't want to use a 2nd work field as an interim integer field.

I will keep this note in save email!

Thanks again.





-----Original Message-----
From: cobol400-l-bounces@xxxxxxxxxxxx [mailto:cobol400-l-bounces@xxxxxxxxxxxx] On Behalf Of MichaelQuigley@xxxxxxxxxx
Sent: Friday, November 30, 2012 7:43 AM
To: cobol400-l@xxxxxxxxxxxx
Subject: Re: [COBOL400-L] how to extract the most common date format - YYYYMMDD

Okay WS-DATE is a FORMAT DATE item. Does it have the format specified?
i.e.:

01 WS-DATE FORMAT DATE '@Y%m%d'.

If so, a simple:

move WS-DATE to A0468X-DUE-DATE of AFTR

will do the trick--no need to extract or convert.

You can even specify that all date fields should be treated as though
formatted YYYYMMDD by specifying:

format date '@Y%m%d'.

or

format of date is '@Y%m%d'.

in the ENVIRONMENT DIVISION under the SPECIAL-NAMES paragraph.

You can tell an individual program to handle a date in whatever format you
please. The actual storage of date fields is known as a Scalliger Integer
representing the number of days since January 1, 4713 BC or somewhere very
close to that in a relative sense.

I think your frustration comes from using EXTRACT-DATE-TIME which is for
extracting date-time information--a number of years, months, days, hours,
minutes, or seconds from a date-time field. CONVERT-DATE-TIME is a more
flexible function and is intended for converting doing conversions from
one format to another like you've described. EXTRACT-DATE-TIME can
extract the year, month, and day in one pass, but that's not it's primary
purpose.

Michael Quigley
Computer Services
The Way International
www.TheWay.org


cobol400-l-bounces@xxxxxxxxxxxx wrote on 11/29/2012 01:00:07 PM:
----- Message from "Stone, Joel" <Joel.Stone@xxxxxxxxxx> on Thu, 29
Nov 2012 15:36:44 +0000 -----

To:

"cobol400-l@xxxxxxxxxxxx" <cobol400-l@xxxxxxxxxxxx>

Subject:

Re: [COBOL400-L] how to extract the most common date format - YYYYMMDD

Thanks for your response.

I am trying to move a DATE-data type to the most common file output
format of YYYYMMDD.

For some reason when the output specifier is @Y%m%d (=YYYYMMDD),
then COBOL is not able to use the MOVE verb to move it to an alpha
field. (Works great for @Y/%m/%d).

Apparently the only solution is to use COMPUTE, which isnt
consistent with ILE COBOL in that any other MOVE numeric to alpha
works just fine.

COMPUTE works well, so I will use that.

It is frustrating that such a simple and common use - moving a date
to a column - works fine with slashes, but fails and requires a
work-around without slashes.

Every other OS & DB mgmt system handles this stuff consistently - at
least the ones that are still around:)


Thanks again.


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.