|
CRTDUPOBJ and the Library List
Dear Readers:
If you occasionally use the Create Duplicate Object (CRTDUPOBJ) command to duplicate an object somewhere in the library list, here's a tip for you.
Before V4R5, it was necessary to tell CRTDUPOBJ which library contained the object to be duplicated.
To duplicate an object that was somewhere in the library list, you had to use code like this:
/* V4R4 and before */
DCL VAR(&LIB) TYPE(*CHAR) LEN(10)
RTVOBJD OBJ(CUSTOMER) +
OBJTYPE(*FILE) RTNLIB(&LIB)
CRTDUPOBJ OBJ(CUSTOMER) FROMLIB(&LIB) +
OBJTYPE(*FILE) +
TOLIB(QTEMP) DATA(*YES)
The Retrieve Object Description (RTVOBJD) command is used to locate the library in which the object is stored.
As of V4R5, that is no longer necessary. IBM added two special values--*LIBL and *CURLIB--to the FROMLIB parameter.
/* V4R5 and after */
CRTDUPOBJ OBJ(CUSTOMER) FROMLIB(*LIBL) +
OBJTYPE(*FILE) +
TOLIB(QTEMP) DATA(*YES)
-- David
|