RPGIV @ Work

A unique site for RPG and System i Lovers

Welcome!

Hi, this site will provide all what you need in System i and RPG developments.

My Name is Chamara Withanachchi, System i Expert and RPG Developer. And in the field for last 11 years.

I hope you will find lot of valuable information from this site

QCAPCMD API Print E-mail
User Rating: / 0
PoorBest 
Written by Chamara Withanachchi   

The Process Commands (QCAPCMD) API is used to perform command analyzer processing on command strings. You can check or run CL commands from HLLs as well as check syntax for specific source definition types.


You can use the QCAPCMD API to:

Check the syntax of a command string prior to running it

Prompt the command and receive the changed command string

Run a command from an HLL


Sample codes are from www.code400.com, Jamie Flanary


     dchangedCmd       s            512    inz                                                      
     dcmdstring        s            512    inz                                                      
     dcmdlength        s             10i 0 inz                                                      
     dcmdAvailLen      s             10i 0 inz                                                      
     dcmdChangeLen     s             10i 0 inz                                                      
                                                                                                    
     docbDS            ds                  Qualified                                                
     d type                          10i 0 inz                                                      
     d DBCSdh                         1    inz('0')                                                 
     d prompt                         1    inz('0')                                                 
     d cmdsyntax                      1    inz('0')                                                 
     d msgrtvkey                      4    inz(x'00000000')                                         
     d reserve1                       9    inz(x'000000000000000000')                               
     d ocblength                     10i 0 inz                                                      
     d formatName                     8    inz('CPOP0100')                                          
     d chgcmd                         1    inz                                                      
     d lngchgcmd                     10i 0 inz                                                      
     d lngchgrtn                     10i 0 inz                                                      
                                                                                                    
     d $command        pr                  extpgm('QCAPCMD')                                        
     d   cmdstring                  512    const                                                    
     d   cmdlength                   10i 0 const                                                    
     d   ocb                               likeds(ocbDS)                                            
     d   ocblength                   10i 0 const                                                    
     d   FormatName                   8    const                                                    
     d   ChangedCmd                 512    const                                                    
     d   LenAvailChgd                10i 0 const                                                    
     d   LenChgdCmd                  10i 0 const                                                    
     d   ApiError                          likeds(APIErrorDS)                                         
                                                                                                    
     d APIErrorDS      ds                  Qualified                                                
     d  BytesP                       10I 0 inz(%size(apiErrorDS))                                   
     d  BytesA                       10I 0 inz(0)                                                   
     d  Messageid                     7                                                             
     d  Reserved                      1                                                             
     d  messagedta                  240                                                             
                                                                                                    
      *  Program Information                                                                        
     d progstatus     sds                                                                           
     d  parms            *parms                                                                     
     d  progname         *proc                                                                      
     d  errmsgID                      7    overlay(ProgStatus:40)                                   
     d  errmsg                       80    overlay(ProgStatus:91)                                   
     d  jobname                      10    overlay(ProgStatus:244)                                  
     d  userid                       10    overlay(ProgStatus:254)                                  
     d  Jobnumber                     7    overlay(ProgStatus:264)                                  
                                                                                                    
      /free                                                                                         
                                                                                                    
                 // --------------------- QCAPCMD  ------------------------                         
                                                                                                    
                cmdstring = 'ADDLIBLE NOLIBRARY';                                                   
                cmdlength = %len(%trim(cmdstring));                                                 
                                                                                                    
                $command(cmdstring    :                                                             
                         cmdlength    :                                                             
                         ocbds        :                                                             
                         %len(ocbDS)  :                                                             
                         'CPOP0100'   :                                                             
                         changedCmd   :                                                             
                         cmdAvailLen  :                                                             
                         cmdChangeLen :                                                             
                         APIErrorDS                                                                 
                                       );    
<Previous   Next>