Tip

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

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

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
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
Sort by: OldestNewest

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:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.