|
GA,
%date() will give you the current date, would that be close enough? If
so, I have a tool in my library (or you could write your own) that will
take a date and return a 6 or 8 digit integer:
/free
dateAsInteger( %date() : 6 );
// '*YMD' is the default. If you need a different format, there is
a
// third option
// dateAsInteger( %date() : 6 : '*MDY' );
// check the docs for more details at
// http://www.rpgnext.com/docs/rnbdates.php#dateAsInteger
/end-free
If that wouldn't work, you could replace %date() with any date field,
but that leads to your original conundrum of not knowing the date
format. There is another routine in my library that might help...
/free
myDate = createDate( jobDate );
// http://www.rpgnext.com/docs/rnbdates.php#createDate
/end-free
The problem here is that 010203 could be three different dates, Jan 2
2003, Feb 1 2003 , Feb 3 2001. Check the documentation and you'll see
that you can set a default "resolution" behaviour - you'll have to
decide for yourself if this will work for you.
Of course, if there was a way to determine jobdate's format, most of
this would be moot. Does anyone know if there is an API or anything that
would tell us?
<shameless self-promotion>
-The "xRPG Core Library" is freeware and as such can be used for
commercial purposes and is redistributable.
-It includes over forty procedures, several helpful /copy books and a
couple of command utilities.
-Frequently updated.
-You must be at V5R1.
-Sorry, no source code.
To download the library, please visit http://www.rpgnext.com - it's free
and easy.
</shameless self-promotion>
Joel
http://www.rpgnext.com
On Wed, 2003-10-01 at 21:46, G Armour wrote:
> Esteemed Listers,
>
> Given variables:
> JobDate: 6-character alpha always guaranteed to contain a valid *JOB date
> YYMMDD#: 6-digit numeric
>
> Is there a way to move JobDate into YYMMDD# in one EVAL, converting it from
> the *JOB
> date format to yymmdd format along the way? The sticky point is that I won't
> know
> at compile time whether *JOB date format is mdy, ymd, etc.
>
> I'm thinking maybe nested date BIFs of some sort, but I'm not familiar enough
> with
> them to get a handle on it.
>
> TIA, GA
>
> __________________________________
> Do you Yahoo!?
> The New Yahoo! Shopping - with improved product search
> http://shopping.yahoo.com
> _______________________________________________
> This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
> To post a message email: RPG400-L@xxxxxxxxxxxx
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
> or email: RPG400-L-request@xxxxxxxxxxxx
> 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 mailing list archive is Copyright 1997-2025 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.