× 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: Yesterdays date
  • From: bmorris@xxxxxxxxxx
  • Date: Wed, 28 Jun 2000 12:29:42 -0400




>Date: Mon, 26 Jun 2000 23:43:03 GMT
>From: booth@martinvt.com
>
>Three lines:
>
>  D DateISO            d         DATFMT(*ISO)
>  C   *jobrun        Move     *DATE             DateISO
>  C                  SubDur   1:*D              Date ISO

Ah, one of my pet common errors!

Never, never, never use *jobrun with *DATE.

Reasons:
1. *jobrun refers to a format with 2-digit years and *date is in
   a format with 4-digit years,
2. *jobrun uses the job format, but *date uses the H spec DATEDIT format.

*jobrun is most useful with the 6-digit numeric result of the TIME opcode;
be sure to use MOVEL, not MOVE, to handle a job format of *JUL correctly.

Here's the only reliable way RPG way to handle this problem if you
can't put a date field in the result of the TIME opcode (if you are on
V3R2):

 D DateISO       S         d      DATFMT(*ISO)
 D TimeRes       DS
 D    Time12             12S 0
 D    TimeDate            6S 0    OVERLAY(Time12)
 C                   Time              Time12
 C    *Jobrun        MoveL    TimeDate DateISO
 C                   SubDur   1:*D     Date ISO

- use the 12 digit result for TIME, not the 14 digit, so you get
  the 6-digit date part, with 2 digit years.
- use MOVEL in case the result only has 5 digits.

If you need to do this with UDATE or *DATE, it's easiest to use UDATE
with the format from the DATEDIT keyword on the H spec (defaults to *MDY).
If you want to use *DATE instead of UDATE, be sure to map the DATEDIT
format correctly:
  *YMD --> *ISO
  *MDY --> *USA
  *DMY --> *EUR

Barbara Morris


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

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.