User-defined options make it easier to work with source objects

Learn more about 'User Defined Options' call utility programs in this member submitted tip.

This Content Component encountered an error

As a programmer, I work constantly within PDM working with source members. I added two 'User Defined Options' that call my utility programs, which will issue "CHGOBJOWN" or "EDTOBJAUT" commands on the source objects. If the object is not in the same source library, you will need to prompt the 'User Defined Option' and change the library. The "CHGOBJOWN" program will prompt the command automatically so the new owner information can be entered.


After creating the below programs, add two entries to the 'User Defined Options' within pdm (Function Key 16):

 
1.) CO  CALL PGM(QGPL/SYCPDMCO) PARM(&L &N &T) 
2.) EA  CALL PGM(QGPL/SYCPDMEA) PARM(&L &N &T) 
--------------------------
Code for SYCPDMCO:
 PGM     PARM(&LIB &OBJ &TYP)
 DCL   VAR(&LIB) TYPE(*CHAR) LEN(10)    
 DCL   VAR(&OBJ) TYPE(*CHAR) LEN(10)    
 DCL   VAR(&TYP) TYPE(*CHAR) LEN(10)    
 DCL   VAR(&DTA) TYPE(*CHAR) LEN(30)    
 DCL   VAR(&OBJTYP) TYPE(*CHAR) LEN(10)

/*Change Member Type to Object Type */
 IF  COND(&TYP *EQ 'CMD') THEN(CHGVAR + 
       VAR(&OBJTYP) VALUE('*CMD'))  

 IF  COND((&TYP *EQ 'CLP') *OR (&TYP *EQ 'RPG') *OR (&TYP *EQ 'RPGLE')) THEN(CHGVAR VAR(&OBJTYP) VALUE('*PGM'))   

 IF COND((&TYP *EQ 'DSPF') *OR (&TYP *EQ 'PRTF') *OR (&TYP *EQ 'LF') *OR (&TYP *EQ 'PF')) THEN(CHGVAR VAR(&OBJTYP) VALUE('*FILE'))  

/* Automatically prompt command */
 ?CHGOBJOWN  OBJ(&LIB/&OBJ) OBJTYPE(&OBJTYP) 

/* end program if command cancelled */
 MONMSG     MSGID(CPF6801) EXEC(GOTO CMDLBL(ENDIT)) 

/* send message on error */
 MONMSG     MSGID(CPF2208) EXEC(DO)                       
 CHGVAR VAR(%SST(&DTA 1 10))  VALUE(&OBJ)             
 CHGVAR VAR(%SST(&DTA 11 7)) VALUE(%SST(&OBJTYP 2 4)) 
 CHGVAR VAR(%SST(&DTA 18 10))  VALUE(&LIB)            
 SNDPGMMSG  MSGID(CPF2208) MSGF(QCPFMSG) MSGDTA(&DTA)     
 ENDDO                                                    
                       
 ENDIT:      ENDPGM    
---------------------------   
Code for SYCPDMEA: 
PGM        PARM(&LIB &OBJ &TYP) 

DCL    VAR(&LIB) TYPE(*CHAR) LEN(10)   
DCL    VAR(&OBJ) TYPE(*CHAR) LEN(10)   
DCL    VAR(&TYP) TYPE(*CHAR) LEN(10)   
DCL    VAR(&DTA) TYPE(*CHAR) LEN(30)   
DCL    VAR(&OBJTYP) TYPE(*CHAR) LEN(10)

/*Change Member Type to Object Type */
IF  COND(&TYP *EQ 'CMD') THEN(CHGVAR + 
       VAR(&OBJTYP) VALUE('*CMD'))  

 IF  COND((&TYP *EQ 'CLP') *OR (&TYP *EQ 'RPG') *OR (&TYP *EQ 'RPGLE')) THEN(CHGVAR VAR(&OBJTYP) VALUE('*PGM'))   

 IF COND((&TYP *EQ 'DSPF') *OR (&TYP *EQ 'PRTF') *OR (&TYP *EQ 'LF') *OR (&TYP *EQ 'PF')) THEN(CHGVAR VAR(&OBJTYP) VALUE('*FILE'))  

/* edit object authority */
 EDTOBJAUT  OBJ(&LIB/&OBJ) OBJTYPE(&OBJTYP)

/* end program if command cancelled */
MONMSG     MSGID(CPF6801) EXEC(GOTO CMDLBL(ENDIT)) 

/* send message on error */
 MONMSG     MSGID(CPF2208) EXEC(DO)                       
 CHGVAR VAR(%SST(&DTA 1 10))  VALUE(&OBJ)             
 CHGVAR VAR(%SST(&DTA 11 7)) VALUE(%SST(&OBJTYP 2 4)) 
 CHGVAR VAR(%SST(&DTA 18 10))  VALUE(&LIB)            
 SNDPGMMSG  MSGID(CPF2208) MSGF(QCPFMSG) MSGDTA(&DTA)     
 ENDDO                                                                
 ENDIT:      ENDPGM    

==================================
MORE INFORMATION ON THIS TOPIC
==================================

The Best Web Links: tips, tutorials and more.

Ask your programming questions--or help out your peers by answering them--in our live discussion forums.

Ask the Experts yourself: Our application development gurus are waiting to answer your programming questions.

This was first published in August 2002

Dig deeper on RPG iSeries programming

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchEnterpriseLinux

SearchDataCenter

Close