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



This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
--
[ Picked text/plain from multipart/alternative ]
Well, it depends! I am not sure which version of COBOL you are using and for
life of me I can not remember the last time I used TODAYS-DATE so, to point
you in a slightly different direction, I offer the following from the AS/400
ILE COBOL Guide. Obviously the example adds to what you are attempting but
has the meat and spuds you need.

Date and Time: The following example shows how to calculate a due date that
is
90 days from today. The first eight characters returned by the CURRENT-DATE
function represent the date in a 4-digit year, 2-digit month, and 2-digit
day format
(YYYYMMDD). In the example, this date is converted to its integer value.
Then 90
is added to this value, and the integer is converted back to the YYYYMMDD
format.

01 YYYYMMDD PIC 9(8).
01 INTEGER-FORM PIC S9(9).
.
.
.
MOVE FUNCTION CURRENT-DATE(1:8) TO YYYYMMDD.
COMPUTE INTEGER-FORM = FUNCTION INTEGER-OF-DATE(YYYYMMDD).
ADD 90 TO INTEGER-FORM.
COMPUTE YYYYMMDD = FUNCTION DATE-OF-INTEGER(INTEGER-FORM).
DISPLAY 'Due Date: ' YYYYMMDD.

------------
The following list describes the enhancements made to ILE COBOL in V3R7:
¹ Century support
The capability for users to work with a 4-digit year has been added in the
following
statements and functions:
- ACCEPT statement with the YYYYDDD and YYYYMMDD phrases
- The following intrinsic functions convert a 2-digit year to a 4-digit
year:
About This Guide xxi
- DATE-TO-YYYYMMDD
- DAY-TO-YYYYDDD
- YEAR-TO-YYYY
- The following intrinsic functions return a 4-digit year:
- CURRENT-DATE
- DAY-OF-INTEGER
- DATE-OF-INTEGER
- WHEN-COMPILED

-----Original Message-----
From: Eric Tubbs [mailto:eatubbs@email.com]
Sent: Wednesday, August 14, 2002 11:34 AM
To: cobol400-l@midrange.com
Subject: Date Handling Problem


[ Converted text/html to text/plain ]

Greetings all again,

I have come across a predictament that I havent been able to fully solve. My
efforts have landed me pretty darn close, but I cannot seem to figure the
rest
out. Figuring out how to get the date working correctly has been a challenge
for me (a student). As you can see from the the Printer Spacing Chart below,
it shows today's date, but the year is being displayed wrong.

Would somebody please like to point me in the right direction (and not just
giving me the answer and sending me along my way please, because I still
want
to learn) of where I am messing up? The only item that doesnt work in my
program is this. I have included the following sections of code that I felt
were revelant to this question without having to put my who program in this
posting.

Many thanks to all,

Eric

*...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+.
..
08/14/0002    CUSTOMER ELECTRICITY AND GAS USAGE REPORT         PAGE  1
     ACCOUNT                              ELECT     ELECT       GAS      GAS
     NUMBER   CUSTOMER NAME                USED      BILL       USED
BILL
     12345    Yanni      Lostly            1,204    $456.00      984
$654.00
     54687    Paul       Winters           9,874     $15.04      845
$2.47
      8745    Samuel     Taylor           78,954    $235.85   56,412
$587.47



0057.00        WORKING-STORAGE SECTION.
0058.00
0059.00        01  WS-CONTROL-FIELDS.
0060.00            05  ARE-THERE-MORE-RECORDS      PIC X(03)  VALUE 'YES'.
0061.00            05  WS-LINE-COUNTER             PIC 9(03)  PACKED-DECIMAL
0062.00                                                       VALUE 60.
0063.00            05  WS-LINE-LIMIT               PIC 9(03)  PACKED-DECIMAL
0064.00                                                       VALUE 60.
0065.00            05  WS-PAGE-COUNTER             PIC 9(03)  PACKED-DECIMAL
0066.00                                                       VALUE ZERO.
0067.00        01  TODAYS-DATE                     PIC 9(8).
0068.00
0069.00        01  TODAYS-DATE-R REDEFINES TODAYS-DATE.
0070.00            05  TD-YEAR                     PIC 9(4).
0071.00            05  TD-MONTH                    PIC 9(2).
0072.00            05  TD-DAY                      PIC 9(2).
0073.00
0074.00        01  HEADING-1.
0075.00            05  HL-MONTH                    PIC 9(02).
0076.00            05                              PIC X      VALUE '/'.
0077.00            05  HL-DAY                      PIC 9(02).
0078.00            05                              PIC X      VALUE '/'.
0079.00            05  HL-YEAR                     PIC 9(04).
0080.00            05                              PIC X(04).

0133.00        PROCEDURE DIVISION.
0134.00
0135.00        000-MAIN-MODULE.
0136.00
0137.00            OPEN INPUT  CUSTOMER-USAGE-FILE
0138.00                 OUTPUT CUSTOMER-USAGE-REPORT.
0139.00
0140.00            ACCEPT TODAYS-DATE FROM DATE.
0141.00            MOVE TD-MONTH TO HL-MONTH.
0142.00            MOVE TD-DAY TO HL-DAY.
0143.00            MOVE TD-YEAR TO HL-YEAR.
--

_______________________________________________
Sign-up for your own FREE Personalized E-mail at Mail.com[1]

===References:===
  1. http://www.mail.com/?sr=signup

_______________________________________________
This is the COBOL Programming on the iSeries/AS400 (COBOL400-L) mailing list
To post a message email: COBOL400-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/cobol400-l
or email: COBOL400-L-request@midrange.com
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 ...


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.