On Nov 25, 2019, at 11:11 PM, John Yeung <gallium.arsenide@xxxxxxxxx> wrote:
But it DOES depend on the format. And I don't control that. If the date was defined as *MDY in the table (yes I know that is foolish but people do it) then in the program it occupies 8 bytes. If it is *ISO or *USA then it is 10 bytes.
It sounded like you wanted to look at things from an SQL point of view
(you mentioned "table" rather than "file" for example). From that
point of view, a date is a date is a date. My understanding is that
there isn't such a thing as defining a date format *in the table*,
even though you can do it in a file with DDS.
Of course, I think it would be conceptually possible for IBM to
provide more SQL exposure to DDS-specific features, but so far I don't
think they've done it for this, and I wouldn't expect them to.
Is there another table or a column in either SYSCOLUMNS or SYSCOLUMN2 that does accurately represent the size of the column or do I have to calculate it?
I am pretty sure you have to calculate it. But it's not hard. I think
what you are after is simply LENGTH(CHAR(my_date_field)).
Not quite that easy - remember i said it was a utility function - so the name of the field is not known at compile time.
What does being utility software have to do with anything? One of the
benefits of using SQL is that you have the flexibility to introspect
and compose at run time. That actually strikes me as one of the
primary purposes of SYSCOLUMNS in the first place.
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
Please contact support@xxxxxxxxxxxx for any subscription related questions.
Help support midrange.com by shopping at amazon.com with our affiliate link: https://amazon.midrange.com
As an Amazon Associate we earn from qualifying purchases.
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.