|
**********************************************************************
* numeric dates
d @numa s 6 0 inz(041205)
d @numb s 7 0 inz(1041206)
d @numc s 8 0 inz(20041207)
d @numd s 6 0 inz(120804)
d @nume s 8 0 inz(12092004)
**********************************************************************
//numeric to numeric...
@numa = %dec(%char(%date(@numd:*mdy):*ymd0):6:0); //mmddyy to yymmdd
@numb = %dec(%char(%date(@numa:*ymd):*cymd0):7:0); //yymmdd to cyymmdd
@numc = %dec(%char(%date(@numa:*ymd):*iso0):8:0); //yymmdd to ccyymmdd
@numd = %dec(%char(%date(@numa:*ymd):*mdy0):6:0); //yymmdd to mmddyy
@nume = %dec(%char(%date(@numa:*ymd):*usa0):8:0); //yymmdd to mmddccyy
@numa = %dec(%char(%date(@numb:*cymd):*ymd0):6:0); //cyymmdd to yymmdd
@numc = %dec(%char(%date(@numb:*cymd):*iso0):8:0); //cyymmdd to ccyymmdd
@numd = %dec(%char(%date(@numb:*cymd):*mdy0):6:0); //cyymmdd to mmddyy
@nume = %dec(%char(%date(@numb:*cymd):*usa0):8:0); //cyymmdd to mmddccyy
@numa = %dec(%char(%date(@numc:*iso):*ymd0):6:0); //ccyymmdd to yymmdd
@numb = %dec(%char(%date(@numc:*iso):*cymd0):7:0); //ccyymmdd to cyymmdd
@numd = %dec(%char(%date(@numc:*iso):*mdy0):6:0); //ccyymmdd to mmddyy
@nume = %dec(%char(%date(@numc:*iso):*usa0):8:0); //ccyymmdd to mmddccyy
@numa = %dec(%char(%date(@numd:*mdy):*ymd0):6:0); //mmddyy to yymmdd
@numb = %dec(%char(%date(@numd:*mdy):*cymd0):7:0); //mmddyy to cyymmdd
@numc = %dec(%char(%date(@numd:*mdy):*iso0):8:0); //mmddyy to ccyymmdd
@nume = %dec(%char(%date(@numd:*mdy):*usa0):8:0); //mmddyy to mmddccyy
@numa = %dec(%char(%date(@nume:*usa):*ymd0):6:0); //mmddccyy to yymmdd
@numb = %dec(%char(%date(@nume:*usa):*cymd0):7:0); //mmddccyy to cyymmdd
@numc = %dec(%char(%date(@nume:*usa):*iso0):8:0); //mmddccyy to ccyymmdd
@numd = %dec(%char(%date(@nume:*usa):*mdy0):6:0); //mmddccyy to mmddyy
*inlr = *on;
/end-free
Pete Helgren <Pete@xxxxxxxxxx> To: RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx> Sent by: cc: rpg400-l-bounces@m Subject: Those flippin dates idrange.com 09/05/2007 03:00 PM Please respond to RPG programming on the AS400 / iSeries
What would be the most expedient way to convert a 6.0 numeric field that
represents a date in MMDDYY format to a 6.0 numeric field that
represents a date in YYMMDD order? The resultant numeric is used in an
SQL statement comparing it to a numeric (not a date) field. The old
technique of YYMMDD = MMDDYY * 10000.0001 appears not to work because
the program is cranky at runtime about the result field not being large
enough.
Since the compare is a numeric I figured that the math would be
numeric. Or, is using a date field and converting it to a numeric host
variable for the SQL the way to go?
Pete Helgren
--
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-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.