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



Hi Mike,

How about just

    D TimeDate                        d
    C                   Time                    TimeDate

The DATFMT() is only relevant when moving a date field to a character field
or a numeric field or vice versa. Since your procedure GCurrDate is
returning a date-type field, you don't need to worry about format.

I don't recall which release first allowed doing TIME to a date or timestamp
field, so if you're on an older release, you may not be able to do this.
However, since you know the TimeDate field is in *USA format, and your
result field is a DATE field, this

    c    *usa    move         TimeDate    DateAlpha
    c            return       DateAlpha

should do it.

hth,
Peter Dow
Dow Software Services, Inc.
909 425-0194 voice
909 425-0196 fax

----- Original Message -----
From: "Smith, Mike" <Mike_Smith@RGCResources.com>
To: <rpg400-l@midrange.com>
Sent: Wednesday, August 15, 2001 12:39 PM
Subject: RE: dates as parms


> sure.
>
> here is the prototype.
>  D GCurrDate       PR              D
>  D  Dt_Fmt                        4    Value
>
> here is the procedure
> PGCurrdate        B                   Export
>  *
>  *  Input Values
>  *
> D GCurrDate       PI              D
> D  Dt_Fmt                        4    Value
>
>   *
>  D DateMDY         S               D   datfmt(*mdy)
>  D DateDMY         S               D   datfmt(*dmy)
>  D DateYMD         S               D   datfmt(*ymd)
>  D DateJUL         S               D   datfmt(*jul)
>  D DateISO         S               D   datfmt(*iso)
>  D DateUSA         S               D   datfmt(*usa)
>  D DateEUR         S               D   datfmt(*eur)
>  D DateJIS         S               D   datfmt(*jis)
> D DateAlpha       S               D   Inz
>
> D                 ds
> D TimeDate                      14  0
> D  Time60                        6  0 overlay(TimeDate:  1)
> D  Date80                        8  0 overlay(TimeDate:  7)
>
>   *----------------------------------------------------*
>   *  Get the current time                              *
>   *----------------------------------------------------*
>  C                   Time                    TimeDate
>  C                   Select
>  C                   When      Dt_Fmt   = '*MDY'
>  C     *usa          Move      Date80        DateMDY
>  C                   Movel     DateMDY       DateAlpha
>
>  *
> C                   When      Dt_Fmt   = '*DMY'
> C     *usa          Move      Date80        DateDMY
> C                   Movel     DateDMY       DateAlpha
>  *
> C                   When      Dt_Fmt   = '*YMD'
> C     *usa          Move      Date80        DateYMD
> C                   Movel     DateYMD       DateAlpha
>  *
>   *
>  C                   When      Dt_Fmt   = '*JUL'
>  C     *usa          Move      Date80        DateJUL
>  C                   Movel     DateJUL       DateAlpha
>   *
>  C                   When      Dt_Fmt   = '*ISO'
>  C     *usa          Move      Date80        DateISO
>  C                   Movel     DateISO       DateAlpha
>
>   *
>  C                   When      Dt_Fmt   = '*USA'
>  C     *usa          Move      Date80        DateUSA
>  C                   Movel     DateUSA       DateAlpha
>   *
>  C                   When      Dt_Fmt   = '*EUR'
>  C     *usa          Move      Date80        DateEUR
>  C                   Movel     DateEUR       DateAlpha
>   *
>   *
>  C                   When      Dt_Fmt   = '*JIS'
>  C     *usa          Move      Date80        DateJIS
>  C                   Movel     DateJIS       DateAlpha
>  C                   EndSl
>   *
>  C                   Return    DateAlpha
>  P GCurrDate       E
>
> here is the pertinent pieces from the call
>
> D#CURRENT         S               D
> EVAL      #CURRENT = GCURRDATE('*MDY')
>
>
>
> -----Original Message-----
> From: James Rich [mailto:james@eaerich.com]
> Sent: Wednesday, August 15, 2001 3:35 PM
> To: 'rpg400-l@midrange.com'
> Subject: RE: dates as parms
>
>
> On Wed, 15 Aug 2001, Smith, Mike wrote:
>
> > i too have programs that pass in the date.  My problem(and its probably
> > something stupid) is i can't get a date to pass back to my calling
> program.
> >
> > i've tried making the formats the same in the calling pgm and procedure.
> >
> > I checked to make sure that at the point the return is being executed,
> there
> > is a valid date in the return variable.
> >
> > i don't know what else to check.
>
> Could you post to the list some examples of what you have that doesn't
> work?  I haven't used a date data type as a return value specifically, but
> I see no reason why it wouldn't work.
>
> James Rich
> james@eaerich.com
>
> _______________________________________________
> This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
> To post a message email: RPG400-L@midrange.com
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l
> or email: RPG400-L-request@midrange.com
> _______________________________________________
> This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
> To post a message email: RPG400-L@midrange.com
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l
> or email: RPG400-L-request@midrange.com


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com



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