|
Hi Tomwill point out the error of my ways.
This is the way that I understand date fields to work, hopefully someone
when you want to display that date (on a screen, report etc.) When you say "
A date field will hold the same value for the same date (number of
days since a particular date), irrespective of the format (*MDY, *YMD,
*USA etc. with or without separators) The date format is to be used ONLY
That is probably due to what the system/job parameter is set forignorant.
Alan Shore
Programmer/Analyst, Direct Response
E:AShore@xxxxxxxx
P:(631) 200-5019
C:(631) 880-8640
"If you're going through Hell, keep going" - Winston Churchill
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Thomas Garvey
Sent: Wednesday, June 27, 2012 12:14 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: I guess I don't know dates
I'm perplexed by something that must be very simple, yet I must be
I can't get date data type fields populated in a PF correctly.date formats (*USA, *ISO, *MDY, *JUL, etc.). The fields that permit use of
I have a DDS physical file with date data type fields defined with various
values in the form of YYYYMMDD. Program X has stand alone date data type
This file is populated (by RPGLE program X) from another file with numeric
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 dthe DateISO field (defined as *ISO) and then moves the DateISO into each of
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 DDS PF (definition example shown below), they all get *MDY. Doesn't
However, when these values are then moved into the fields as defined in
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 Lfield simply changes the format of the value.
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
only for the individual named. If you are not the named addressee you should
Straighten me out here, please.
Tom Garvey
--
This is the RPG programming on the IBM i / System i (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.
Disclaimer: This message contains confidential information and is intended
----
This is the RPG programming on the IBM i / System i (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.