CRTDUPOBJ from a *LIBL object

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...

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 


This was last published in March 2001

Dig Deeper on RPG iSeries programming

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchEnterpriseLinux

SearchDataCenter

Close