× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



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.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.