If you need to create a copy of a file, or a data area, or other object in QTEMP (or anywhere else), but the source...
By submitting your email address, you agree to receive emails regarding relevant topic offers from TechTarget and its partners. You can withdraw your consent at any time. Contact TechTarget at 275 Grove Street, Newton, MA.
object's library is library list dependant, you know that CRTDUPOBJ needs to have the exact library where the object is to be duplicated from. If you need that kind of flexibility, all you need to do is use RTVOBJD to get the library.
The example creates the object AR809WK in QTEMP only if it can't find the file in QTEMP to clear(CPF3142 means that the file was not found).
DCL VAR(&FILLIB) TYPE(*CHAR) LEN(10) /* Create work file in QTEMP */ CLRPFM FILE(QTEMP/AR809WK) MONMSG MSGID(CPF3142) EXEC(DO) RTVOBJD OBJ(*LIBL/AR809WK) OBJTYPE(*FILE) + RTNLIB(&FILLIB) CRTDUPOBJ OBJ(AR809WK) FROMLIB(&FILLIB) OBJTYPE(*FILE) + TOLIB(QTEMP) DATA(*NO) ENDDO