I would like to use db2/SQL created long file name in RPG program (OS V7.1 or v7.2). I cannot create table with over 10 characters using legacy DDS but Db2/SQL allows me to create tables with long file names. Example:
CREATE TABLE QTEMP.VERYLONGNAMETABLE (COLUMN1 CHAR (30) NOT NULL
WITH DEFAULT)
RCDFMT VERYRC
When I do a work with object command , I see OS recognizes table not as VERYLONGNAMETABLE but as VERYL00001.
If I try to use VERYL00001 name in RPG this works:
DCL-F VERYL00001 DISK(*EXT) USAGE(*INPUT)'
but this fails, because of RPG's 10 character limit:
DCL-F VERYLONGNAMETABLE DISK(*EXT) USAGE(*INPUT)
but I can do this which gives me internal long name but points to external 10 character short name.
DCL-F VERYLONGNAMETABLE DISK(*EXT) USAGE(*INPUT)
extfile('extdesc')
extdesc('VERYL00001') ;
The worrying thing about this is that if I delete VERYL00001 object, and create new table called VERYLONGNAMETABLE_2, OS gives me same VERYL00001 name. This is very worrying because of confusion that it may cause.
I read that I can do and use ALIAS.
CREATE ALIAS VERYLONG FOR VERYLONGNAMETABLE
however this creates a DDMF file, which if I remember from olden days had performance and other issue.
I can also rename (RNMOBJ) VERYL00001 to VERYLONG. Then at least I can have long name for users who want to query on long name, and still use in RPG like this
DCL-F VERYLONGNAMETABLE DISK(*EXT) USAGE(*INPUT)
extfile('extdesc')
extdesc('VERYLONG') ;
or simply:
DCL-F VERYLONG DISK(*EXT) USAGE(*INPUT)
I don't like the fact that each table will be identified by two different names. I am sure that this will cause confusion.
Did I miss any options here?