370 pts.
 create a command
i want create a user diffined command for call perticuler program. please help me on this

Software/Hardware used:
as/400
ASKED: April 26, 2012  7:11 AM
UPDATED: April 30, 2012  5:54 AM

Answer Wiki:
You can use <b>CRTCMD</b> command for creating user defined command. Pradeep.
Last Wiki Answer Submitted:  April 26, 2012  8:18 am  by  deepu9321   3,370 pts.
All Answer Wiki Contributors:  deepu9321   3,370 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

ok,can we run that command from command line?

 370 pts.

 

before creating command,is it required to create any source code?

 370 pts.

 

Yes, You can run that command from command prompt.
And, You will be requried to create a source before creating comamnd(CRTCMD)

Pradeep.

 3,370 pts.

 

Can you provide some samples of source codes you can use?
Also, give examples of command used? Please…

 80 pts.

 

Below is source for a simple command on our system:

        *************** Beginning of data ************************************************
0001.00              CMD        PROMPT('Send break message to user') /* CPP +             
0002.00                                                                   = UTLC0069 */   
0003.00              PARM       KWD(MSG) TYPE(*CHAR) LEN(256) MIN(1) +                    
0004.00                           CASE(*MIXED) PROMPT('Message text')                     
0005.00              PARM       KWD(USERID) TYPE(*NAME) LEN(10) MIN(1) +                  
0006.00                           PROMPT('User ID')                                       
        ****************** End of data ***************************************************

Be sure the parmeters of command processing program (UTLC0069 in this example) match the parm sequence, length and type. CL is very common as a command processing program. RPG work nicely as well.

 5,525 pts.

 

i want create a user diffined command for call perticuler program.

As is often the case, the best place to look is in the Information Center. Step through the topics under Defining and documenting commands for everything you’ll need or want to know. Numerous examples are shown.

Tom

 108,360 pts.

 

thanq u sir,i created one program to display jobdiscription and library.so i want to call this from command line with “jobd” command.so please post the source code for command.

 370 pts.

 

This is the command processing program for the command shown below:

        *************** Beginning of data *********************************************
0001.00 /*---------------------------------------------------------------------------*/
0002.00 /* Program:  UTLC0069                                                       */
0003.00 /* Title:    Send break message to named user                                */
0004.00 /* Notes:    Copied from user example                                        */
0005.00 /*---------------------------------------------------------------------------*/
0006.00 /* ChangeDate  Reason                                                        */
0007.00 /* 01-23-2009  New program                                                   */
0008.00 /*---------------------------------------------------------------------------*/
0009.00              PGM        PARM(&MSGTEXT &USERID)                                 
0010.00                                                                                
0011.00              DCL        VAR(&MSGTEXT) TYPE(*CHAR) LEN(256)                     
0012.00              DCL        VAR(&USERID)  TYPE(*CHAR) LEN(10)                      
0013.00                                                                                
0014.00              DCL        VAR(&MSGTYPE) TYPE(*CHAR) LEN(10) +                    
0015.00                           VALUE('*INFO')                                       
0016.00              DCL        VAR(&DELMODE) TYPE(*CHAR) LEN(10) +                    
0017.00                           VALUE('*BREAK')                                      
0018.00              DCL        VAR(&MSGLENG) TYPE(*CHAR) LEN(04) +                    
0019.00                           VALUE(X'00000100')                                   
0020.00              DCL        VAR(&USRCNT) TYPE(*CHAR) LEN(04) +                    
0021.00                           VALUE(X'00000001')                                  
0022.00              DCL        VAR(&MSGSENT) TYPE(*CHAR) LEN(04) +                   
0023.00                           VALUE(X'00000000')                                  
0024.00              DCL        VAR(&FUNCREQ) TYPE(*CHAR) LEN(04) +                   
0025.00                           VALUE(X'00000000')                                  
0026.00              DCL        VAR(&ERROR) TYPE(*CHAR) LEN(256) +                    
0027.00                           VALUE(X'00000100')                                  
0028.00              DCL        VAR(&SHOWMSG) TYPE(*CHAR) LEN(01) VALUE('N')          
0029.00              DCL        VAR(&REPLYMQ) TYPE(*CHAR) LEN(20)                     
0030.00              DCL        VAR(&NAMETYPE) TYPE(*CHAR) LEN(04) +                  
0031.00                           VALUE('*USR')                                       
0032.00                                                                               
0033.00 /* CLP error handling variables & MONMSG command ------------------ */        
0034.00              DCL        VAR(&ERRORSW)  TYPE(*LGL)                             
0035.00              DCL        VAR(&MSGID)    TYPE(*CHAR) LEN(7)                     
0036.00              DCL        VAR(&MSGDTA)   TYPE(*CHAR) LEN(100)                   
0037.00              MONMSG     MSGID(CPF0000) EXEC(GOTO ERROR)                       
0038.00                                                                               
0039.00              CHKOBJ     OBJ(&USERID) OBJTYPE(*USRPRF)                         
0040.00              MONMSG     MSGID(CPF9801) EXEC(DO)                              
0041.00              SNDPGMMSG  MSG('User ID' *BCAT &USERID *BCAT 'not +             
0042.00                           found.  No message sent.')                         
0043.00              RETURN                                                          
0044.00              EndDo                                                           
0045.00                                                                              
0046.00              CALL       PGM(QSYS/QEZSNDMG) PARM(&MSGTYPE &DELMODE +          
0047.00                           &MSGTEXT &MSGLENG &USERID &USRCNT +                
0048.00                           &MSGSENT &FUNCREQ &ERROR &SHOWMSG +                
0049.00                           &REPLYMQ &NAMETYPE)                                
0050.00                                                                              
0051.00              RETURN     /* Use this command as normal end of program */      
0052.00 /* ----------------------------------------------------------------- */      
0053.00 ERROR:       IF         COND(&ERRORSW) THEN(SNDPGMMSG MSGID(CPF9999) +       
0054.00                         MSGF(QCPFMSG) MSGTYPE(*ESCAPE)) /* Func chk */       
0055.00              CHGVAR     VAR(&ERRORSW) VALUE('1')                             
0056.00 ERROR1:      RCVMSG     MSGID(&MSGID) MSGDTA(&MSGDTA) MSGTYPE(*DIAG)         
0057.00              IF         COND(&MSGID *EQ '       ') THEN(GOTO +               
0058.00                           CMDLBL(ESCAPE))                                    
0059.00              SNDPGMMSG  MSGID(&MSGID) MSGDTA(&MSGDTA) +                      
0060.00                             MSGF(QCPFMSG) MSGTYPE(*DIAG)                       
0061.00              GOTO       CMDLBL(ERROR1) /* Loop back for addl diags */          
0062.00 ESCAPE:      RCVMSG     MSGID(&MSGID) MSGDTA(&MSGDTA) +                        
0063.00                             MSGTYPE(*EXCP)                                     
0064.00              SNDPGMMSG  MSGID(&MSGID) MSGDTA(&MSGDTA) +                        
0065.00                             MSGF(QCPFMSG) MSGTYPE(*ESCAPE)                     
0066.00  EOJ:        ENDPGM                                                            
        ****************** End of data ************************************************
 5,525 pts.

 

its not working will u elaborate the process

 655 pts.

 

its not working will u elaborate the process

The entire process is already elaborated — in the Information Center. There’s no more elaboration possible.

However, if you have a specific problem, please show us the work that you have done and describe any errors that you see.

“its not working” is not enough for us to know how to help.

Tom

 108,360 pts.

 

i created program to display the records from pf.instead of calling the program directly ,i want to call the program from command line with user diffined command.for that i want to create command like “JOBD” for this command please the post source code.

 370 pts.

 

please the post source code.

We don’t have the source code. Were you thinking that this site does the work for people for free?

Tom

 108,360 pts.

 

i done it .Thanq sir

 370 pts.