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


  • Subject: RE: Questions on CONVERT-DATE-TIME and ADD-DURATION
  • From: "Stone, Joel" <StoneJ@xxxxxxxxxxxxxxxx>
  • Date: Tue, 29 Feb 2000 10:00:48 -0500

Title: RE: Questions on CONVERT-DATE-TIME and ADD-DURATION

Have you considered calling a subroutine which would return the current date/time?  With the method you have chosen, unless I am mistaken, you cannot alter the date/time for testing or re-run purposes!

-----Original Message-----
From: Robert E. Burger [mailto:rburger@home.net]
Sent: Monday, February 28, 2000 7:49 PM
To: COBOL400-L@midrange.com
Subject: Re: Questions on CONVERT-DATE-TIME and ADD-DURATION


That misunderstanding was definitely part of my problem.  I thought you told CONVERT-DATE-TIME what you were converting to, not

what you were converting from.  Now I've got to see if I can get it to handle a scenario like:

  MOVE FUNCTION ADD-DURATION (SYSTEM-TIME MONTHS 4 DAYS 5 HOURS 12 MINUTES 15) TO SOME-FUTURE-TIMESTAMP.

We'll see but I think I now understand what I have to do to make it work.

Thanks for the help,

Robert


----- Original Message -----
From: Peter Lunde <telsci@interlog.com>
To: <COBOL400-L@midrange.com>
Sent: Monday, February 28, 2000 2:35 PM
Subject: Re: Questions on CONVERT-DATE-TIME and ADD-DURATION


> The IBM manual says that FUNCTION CONVERT-DATE-TIME argument-2 "specifies
> the category of the return variable".
> So much for IBM manuals.
> Thanks to Finucci Domenico for informing us that argument-2 specifies the
> category of argument-1!
>
> You could save a few move commands by judicial use of a 05 level as follows,
> but it does not make the program any faster or clearer.
> 0013.00        01  W-SYSTEM-DATE.
> 0014.00            05  W-SYSTEM-TIME-NUMERIC    PIC 9(14)V9(2).
> 0016.00        01  W-DATE-1                     PIC
> 9999/99/99/99,99,99.999999.
> 0017.00        01  W-SYSTEM-TIME                FORMAT TIME.
> 0018.00        PROCEDURE DIVISION.
> 0019.00        MAIN-PROGRAM SECTION.
> 0020.00        000-MAIN-PROGRAM.
> 0021.00            MOVE FUNCTION CURRENT-DATE TO W-SYSTEM-DATE.
> 0022.00            DISPLAY W-SYSTEM-TIME-NUMERIC.
> 0023.00            MOVE W-SYSTEM-TIME-NUMERIC TO W-DATE-1.
> 0024.00            MOVE "-"                   TO W-DATE-1(5:1)
> 0025.00            MOVE "-"                   TO W-DATE-1(8:1)
> 0026.00            MOVE "-"                   TO W-DATE-1(11:1)
> 0027.00            MOVE "."                   TO W-DATE-1(14:1)
> 0028.00            MOVE "."                   TO W-DATE-1(17:1)
> 0029.00            MOVE FUNCTION CONVERT-DATE-TIME(W-DATE-1 TIMESTAMP)
> 0030.00              TO W-SYSTEM-TIME.
> No wonder people are migrating away from COBOL is it takes 7 statements to
> put the current date into a timestamp format.
> Yes, I know you can INSPECT W-DATE-1 REPLACING "/" WITH "-".
> and INSPECT W-DATE-1 RELACING "," WITH "."., but that's slower and still
> leaves 4 statements.
> Hey IBM!  How about "MOVE FUNCTION CURRENT-DATE(TIMESTAMP) TO W-DATE-1."?
> I know, I know.  Use an API.  But why do I have to retrieve the system
> status just to get the current date in a timestamp format?
>
> ----- Original Message -----
> From: "Finucci Domenico" <finucci@Fiditalia.it>
> To: <COBOL400-L@midrange.com>
> Cc: "'Robert E. Burger'" <rburger@home.net>
> Sent: Monday, February 28, 2000 3:30 AM
> Subject: R: Questions on CONVERT-DATE-TIME and ADD-DURATION
>
>
> > -----Messaggio originale-----
> > Da: Robert E. Burger [mailto:rburger@home.net]
> > Inviato: domenica 27 febbraio 2000 08.20
> > A: cobol400-L@midrange.com
> > Oggetto: Questions on CONVERT-DATE-TIME and ADD-DURATION
> >
> > Answer :
> > Try to edit the program this way:
> >
> > WORKING
> > 01 w-SYSTEM-DATE           pic x(21).
> > (**) 01 w-date-1                             pic x(26).
> > 01 w-SYSTEM-TIME           FORMAT TIME.
> >
> >
> > (**) You know that the format for a timestamp item must be:
> > "YYYY-MM-DD-hh.mm.ss.nnnnnn"  where nnn is 1000th sec,
> >            26 byte total.
> >
> >
> > PROCEDURE
> >  move w-system-date(1:4)  to w-date-1(1:4)
> >  move "-"                                  to w-date-1(5:1)
> >  move w-system-date(5:2)  to w-date-1(6:2)
> >  move "-"                                  to w-date-1(8:1)
> >  move w-system-date(7:2)  to w-date-1(9:2)
> >  move "-"                                  to w-date-1(11:1)
> >  move w-system-date(9:2)  to w-date-1(12:2)
> >  move "."                                  to w-date-1(14:1)
> >  move w-system-date(11:2) to w-date-1(15:2)
> >  move "."                                   to w-date-1(17:1)
> >  move w-system-date(13:2) to w-date-1(18:2)
> >  move "."                                    to w-date-1(20:1)
> >  move "000000"                       to w-date-1(21:6)
> >  display "w-date-1 " w-date-1
> >  MOVE FUNCTION CONVERT-DATE-TIME (w-date-1  TIMESTAMP)
> >       TO w-SYSTEM-TIME.
> >
> > Let me know if this works on yr. AS/400 too.
> > Regards.
> > D. Finucci
> > Fiditalia SPA, Milano
> >
> >
> >
> > +---
> > | This is the COBOL/400 Mailing List!
> > | To submit a new message, send your mail to COBOL400-L@midrange.com.
> > | To subscribe to this list send email to COBOL400-L-SUB@midrange.com.
> > | To unsubscribe from this list send email to
> COBOL400-L-UNSUB@midrange.com.
> > | Questions should be directed to the list owner/operator:
> david@midrange.com
> > +---END
> >
> >
>
> +---
> | This is the COBOL/400 Mailing List!
> | To submit a new message, send your mail to COBOL400-L@midrange.com.
> | To subscribe to this list send email to COBOL400-L-SUB@midrange.com.
> | To unsubscribe from this list send email to COBOL400-L-UNSUB@midrange.com.
> | Questions should be directed to the list owner/operator: david@midrange.com
> +---END
>

+---
| This is the COBOL/400 Mailing List!
| To submit a new message, send your mail to COBOL400-L@midrange.com.
| To subscribe to this list send email to COBOL400-L-SUB@midrange.com.
| To unsubscribe from this list send email to COBOL400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---END


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.