Are you tired of being stuck to 10 Upper Case characters for field names?

Well before you start changing your current naming convention you’ll want to make sure the others you work with are cool with your idea for naming conventions.  People will need to realize the differences between a SQL (strsql,PHP (db2_*)) and System perspective (dbu, query, etc…).    There’s really 3 scenarios for naming fields:

1) Always use system naming 10 character uppercase.  This is best for applications where RPG and PHP will both be accessing the table.  Keeps both developers on the same page
MYCOLTHATS DECIMAL(9, 0) DEFAULT NULL ,

2) Use SQL Name and System name all uppercase
MYCOLTHATSLONG FOR COLUMN MYCOLTHATS DECIMAL(9, 0) DEFAULT NULL ,

3) Use SQL Name in mix case (camel case, all lower, etc…) and System name
“MyColThatsLong” FOR COLUMN MYCOLTHATS DECIMAL(9, 0) DEFAULT NULL ,

Tip:  use the “FOR COLUMN <system field name>” to specify a nice system name instead of an autogenerated system name like MYCOL00001.  If you do:

MYCOLTHATSLONG DECIMAL(9, 0) DEFAULT NULL ,

you’ll get

MYCOLTHATSLONG FOR COLUMN MYCOL00001 DECIMAL(9, 0) DEFAULT NULL ,

Example:

/* Altering table MYLIB.CUSTMASPF */
ALTER TABLE MYLIB.CUSTMASPF
ADD COLUMN CUSTOMERNAME FOR CUSTNAME VARCHAR (100) NOT HIDDEN
ADD COLUMN CUSTOMERADDRESS FOR CUSTADDR VARCHAR (100) NOT HIDDEN;
/* Setting column labels for MYLIB.CUSTMASPF */
LABEL ON COLUMN MYLIB.CUSTMASPF (
CUSTOMERNAME TEXT IS 'Customer Name' ,
CUSTOMERADDRESS TEXT IS 'Customer Address' );
/* Setting column headings for MYLIB.CUSTMASPF */
LABEL ON COLUMN MYLIB.CUSTMASPF (
CUSTOMERNAME IS 'Customer Name ' ,
CUSTOMERADDRESS IS 'Customer Address ' );
/* Create a long identifier for MYLIB.CUSTMASPF */
RENAME TABLE MYLIB.CUSTMASPF TO CUSTOMER_FILE FOR SYSTEM NAME CUSTMASPF;
/* Verify we can access the long name*/
SELECT * FROM MYLIB.CUSTOMER_FILE;

Gotcha Note: The actual “File Member” will have the ugly name with MYTAB00001