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



Look at %subdt, it will do the extract in free format.  No matter how you
solve it I would just create a procedure called something like  PriorMonth
that accepts two dates and returns an indicator indicating if date1 is in
the prior month of date2.  The procedure wouldn't necessarily be free format
but all the using code could be

if PriorMonth(date1: date2)
        .......
endif


Scott Mildenberger

> -----Original Message-----
> From: Phil [SMTP:sublime78ska@yahoo.com]
> Sent: Sunday, January 13, 2002 5:02 PM
> To:   rpg400-l@midrange.com
> Subject:      RE: More date questions
>
> Thanks, Scott.
>
> You can't use EXTRCT in free-format.
>
> Phil
>
> > -----Original Message-----
> > From: rpg400-l-admin@midrange.com [mailto:rpg400-l-admin@midrange.com]On
> > Behalf Of Scott Mildenberger
> > Sent: Sunday, January 13, 2002 6:11 PM
> > To: 'rpg400-l@midrange.com'
> > Subject: RE: More date questions
> >
> >
> > Phil,
> >
> > You could extract the month from each date and then compare them,
> > you would
> > also have to extract the year to do it properly.  I know you can use the
> > EXTRCT op-code or there may even be a bif you can use at V5R1(haven't
> got
> > there yet so not sure).
> >
> > Scott Mildenberger
> >
> > > -----Original Message-----
> > > From:     Phil [SMTP:sublime78ska@yahoo.com]
> > > Sent:     Sunday, January 13, 2002 2:48 PM
> > > To:       RPG400-L
> > > Subject:  More date questions
> > >
> > > All,
> > >
> > > I need to know whether one of two dates is in a prior month.  I
> > found this
> > > won't work:
> > >
> > >     from = d'2001-07-31';
> > >     to   = d'2001-08-01';
> > >
> > >     diff = %diff(from:to:*months);
> > >
> > > Diff = 0 in this case.  To me, I'm counting months - not how close the
> > > days
> > > are.  But ok.  So I did this (which works):
> > >
> > >  if %subst(%char(from):6:2) < %subst(%char(to):6:2);
> > >   priorMonth = *on;
> > >   else;
> > >   priorMonth = *off;
> > >  endif;
> > >
> > > My question is:  Is this the correct way to determine if one of
> > two dates
> > > is
> > > in a prior month?
> > >
> > > Thanks,
> > >
> > > Phil
> > >
> > >
> > > _________________________________________________________
> > > Do You Yahoo!?
> > > Get your free @yahoo.com address at http://mail.yahoo.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
> > > Before posting, please take a moment to review the archives
> > > at http://archive.midrange.com/rpg400-l.
> > _______________________________________________
> > 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
> > Before posting, please take a moment to review the archives
> > at http://archive.midrange.com/rpg400-l.
> >
>
>
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.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
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/rpg400-l.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.