|
I'm perplexed by something that must be very simple, yet I must beignorant.
I can't get date data type fields populated in a PF correctly.
I have a DDS physical file with date data type fields defined with
various date formats (*USA, *ISO, *MDY, *JUL, etc.). The fields that
permit use of the DATSEP parameter do have it specified.
This file is populated (by RPGLE program X) from another file with
numeric values in the form of YYYYMMDD. Program X has stand alone
date data type fields defined with each of the various formats and
separators (example below).
d DateMDY s d datfmt(*MDY )
mm/dd/yy
d DateMDYSlsh s d datfmt(*MDY/)
mm/dd/yy
d DateMDYDash s d datfmt(*MDY-)
mm-dd-yy
d DateMDYPerd s d datfmt(*MDY.)
mm.dd.yy
d DateMDYComm s d datfmt(*MDY,)
mm,dd,yy
d DateMDYAmph s d datfmt(*MDY&)
mm dd yy
d DateDMY s d datfmt(*DMY)
dd/mm/yy
d DateDMYSlsh s d datfmt(*DMY/)
dd/mm/yy
d DateDMYDash s d datfmt(*DMY-)
dd-mm-yy
d DateDMYPerd s d datfmt(*DMY.)
dd.mm.yy
d DateDMYComm s d datfmt(*DMY,)
dd,mm,yy
d DateDMYAmph s d datfmt(*DMY&)
dd mm yy
d DateYMD s d datfmt(*YMD)
yy/mm/dd
d DateYMDSlsh s d datfmt(*YMD/)
yy/mm/dd
d DateYMDDash s d datfmt(*YMD-)
yy-mm-dd
d DateYMDPerd s d datfmt(*YMD.)
yy.mm.dd
d DateYMDComm s d datfmt(*YMD,)
yy,mm,dd
d DateYMDAmph s d datfmt(*YMD&)
yy mm dd
d DateJUL s d datfmt(*JUL)
yy/ddd
d DateJULSlsh s d datfmt(*JUL/)
yy/ddd
d DateJULDash s d datfmt(*JUL-)
yy-ddd
d DateJULPerd s d datfmt(*JUL.)
yy.ddd
d DateJULComm s d datfmt(*JUL,)
yy,ddd
d DateJULAmph s d datfmt(*JUL&)
yy ddd
d DateISO s d datfmt(*ISO)
yyyy-mm-dd
d DateISODash s d datfmt(*ISO-)
yyyy-mm-dd
d DateUSA s d datfmt(*USA)
mm/dd/yyyy
d DateUSASlsh s d datfmt(*USA/)
mm/dd/yyyy
d DateEUR s d datfmt(*EUR)
dd.mm.yyyy
d DateEURPerd s d datfmt(*EUR.)
dd.mm.yyyy
d DateJIS s d datfmt(*JIS)
yyyy-mm-dd
d DateJISDash s d datfmt(*JIS-)
yyyy-mm-dd
So, my program X logic moves the numeric value (in YYYYMMDD format)
into the DateISO field (defined as *ISO) and then moves the DateISO
into each of the stand alone fields shown above. The resulting values
are all correct as defined. That is, they contain exactly what they
should contain (the same date value, but in the field's format and
separator). This is verified using debugger.
However, when these values are then moved into the fields as defined
in the DDS PF (definition example shown below), they all get *MDY.
Doesn't matter how they are defined in the DDS.
A DUSASLSH L DATFMT(*USA)
A COLHDG('Date' 'USA Slash')
A DISODASH L DATFMT(*ISO)
A COLHDG('Date' 'ISO Dash')
A DEURPERD L DATFMT(*EUR)
A COLHDG('Date' 'EUR Perd')
A DMDYSLSH L DATFMT(*MDY)
A DATSEP('/')
A COLHDG('Date' 'MDY Slsh')
A DMDYDASH L DATFMT(*MDY)
A DATSEP('-')
A COLHDG('Date' 'MDY Dash')
A DMDYPERD L DATFMT(*MDY)
A DATSEP('.')
A COLHDG('Date' 'MDY Perd')
A DMDYCOMM L DATFMT(*MDY)
A DATSEP(',')
A COLHDG('Date' 'MDY Comm')
A DMDYNONE L DATFMT(*MDY)
A DATSEP(' ')
What is up with that? What am I ignorant of? What am I missing?
There is no DATFMT specification in any H spec. The system's default
format
(QDATFMT) is MDY but I can't believe that is controling here.
I always thought moving a date data type field to another date data
type field simply changes the format of the value.
Straighten me out here, please.
Tom Garvey
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.