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:
CHAR ( 3)

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

The FOR column (field) name may also be referred to as the
system column (field) name.

This thread ...


Return to Archive home page | Return to MIDRANGE.COM home page