create a command

380 pts.
AS/400 commands
i want create a user diffined command for call perticuler program. please help me on this

Software/Hardware used:

Answer Wiki

Thanks. We'll let you know when a new response is added.

You can use <b>CRTCMD</b> command for creating user defined command.


Discuss This Question: 13  Replies

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • 421
    ok,can we run that command from command line?
    380 pointsBadges:
  • 421
    before creating command,is it required to create any source code?
    380 pointsBadges:
  • deepu9321
    Yes, You can run that command from command prompt. And, You will be requried to create a source before creating comamnd(CRTCMD) Pradeep.
    4,605 pointsBadges:
  • AS400Operator
    Can you provide some samples of source codes you can use? Also, give examples of command used? Please...
    80 pointsBadges:
  • WoodEngineer
    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.
    6,955 pointsBadges:
  • TomLiotta
    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
    125,585 pointsBadges:
  • 421
    thanq u sir,i created one program to display jobdiscription and i want to call this from command line with "jobd" please post the source code for command.
    380 pointsBadges:
  • WoodEngineer
    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)                                 
    0011.00              DCL        VAR(&MSGTEXT) TYPE(*CHAR) LEN(256)                     
    0012.00              DCL        VAR(&USERID)  TYPE(*CHAR) LEN(10)                      
    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')                                       
    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)                       
    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                                                           
    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)                                
    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 ************************************************
    6,955 pointsBadges:
  • shiva3322
    its not working will u elaborate the process
    660 pointsBadges:
  • TomLiotta
    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
    125,585 pointsBadges:
  • 421
    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.
    380 pointsBadges:
  • TomLiotta
    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
    125,585 pointsBadges:
  • 421
    i done it .Thanq sir
    380 pointsBadges:

Forgot Password

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

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: