RPG record IO references the system field name only...
With the keyword ALIAS in the F-Specs the long SQL Names can also be used
with native I/O
Mit freundlichen Grüßen / Best regards
Birgitta Hauser
"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"
-----Ursprüngliche Nachricht-----
Von: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] Im Auftrag von DeLong, Eric
Gesendet: Thursday, 29.11 2012 00:07
An: Midrange Systems Technical Discussion
Betreff: RE: V7R1 DB2 for IBMi; ALTER Table cc ADD COLUMN xx FORCOLUMN yy
Not new. This has been supported for some time, perhaps forever...
In your column definition, the name "COUNTRY" is the field name in the SQL
catalog, and adding the "FOR COLUMN nnnnnn" clause causes the system field
name (as implemented into the *FILE object) to be set to WJCTR.
RPG record IO references the system field name only, whereas SQL can
reference either way.
I've been building my DDL this way for years, so that we can use SQL
friendly naming for our columns in SQL... My old queries had to refer to
field data as DSSTR# or SMSTORE or some other "unique" name, but now each of
those fields can be referenced as STORE_NO.
-Eric DeLong
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Eric Lehti
Sent: Wednesday, November 28, 2012 4:24 PM
To: Midrange Systems Technical Discussion
Subject: V7R1 DB2 for IBMi; ALTER Table cc ADD COLUMN xx FOR COLUMN yy
We have been on V7R1 for a week now, having upgraded from V5R4M5.
Issued this SQL command:
ALTER TABLE F55JOBS
ADD COLUMN COUNTRY FOR COLUMN WJCTR
CHAR ( 3)
NOT NULL WITH DEFAULT ' '
In SQL both of these statements return data:
This works: SELECT WJCTR FROM F55jobs
And this works: SELECT country FROM F55jobs
Is this new functionality?
+++++++++++++
The IBM help text for the field COUNTRY says:
Type the column (field) names of the table (file). Do not
use the same name for more than one column of the table
(file) or the system column name of the table (file). You
can define up to 8000 columns.
The IBM help text for WJJCTR says:
Type the FOR column (field) name for the column (field).
This name is optional. If the column (field) name is more than 10
characters long and the FOR column (field) name is
not specified, one will be generated when the table is
created.
The FOR column (field) name may also be referred to as the
system column (field) name.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe,
or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at
http://archive.midrange.com/midrange-l.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe,
or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at
http://archive.midrange.com/midrange-l.
As an Amazon Associate we earn from qualifying purchases.