Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Repliceate F4 when using QCMDEXC

Status
Not open for further replies.

ceiuser

IS-IT--Management
Apr 5, 2003
8
US
Does anyone know how to replicate using the F4 key when calling QCMDEXC from an rpg program?

I need to call the CHGSPLFA command from my program but without the F4, the command does not get prompted.

Thanks in advance.
 
Why don't you prompt the user to enter the information you need to execute the CHGSPLFA command, then build the CHGSPLFA command and then pass that formatted command to QCMDEXC?

Code:
     D CommandLine     PR                  ExtPgm('QCMDEXC')
     D  Cmd                         200    Const Options(*VarSize)
     D  Len                          15  5 Const
     D                    
     D ChangeSplfA     S            200    Inz(*Blanks)
     D SplfName        S             10    Inz(*Blanks)
     D JobNbr          S              6S 0 Inz(*Blanks)
     D JobName         S             10    Inz(*Blanks)
     D JobUser         S             10    Inz(*Blanks)
     D SplfNbr         S              4S 0 Inz(0)
      //------------------------------------------------------------------------
      /Free               
                          
        //  Code to promptthe user to enterthe information needed 
        //  like SPLF name, job nbr, job name, user, etc.
                          
        ChangeSplfA = 'ChgSplfA File(' + %Trim(SplfName) + ')' +
                               'Job(' + %Trim(%EditC(JobNbr:'X')) + '/' + 
                                        %Trim(JobUser) + '/' +
                                        %Trim(JobName) + ')' +
                               'SplNbr(' + %Trim(%EditC(SplfNbr:'Z') + ')'  
                          
        // add whatever field you want to change after that, like OUTQ,          
        // PRINTER, etc...
                          
       CommandLine(ChangeSplfA:%Len(ChangeSplfA));
                          
      /End-Free

Hope this helps

RedMage1967
IBM Certifed - RPG IV Progammer
 
Placing a "?" in front of any CL command will
cause the command to be prompted when it is
issued. For example:
?CHGSPLFA

- vbMax
 
Expanding on vbMax's point, you can use ??, ?* or ? when you want to prompt when calling a command from code. ? before the command prompts everything, ?* before a parameter displays the value which has been passed for the parameter but doesn't allow it to be changed and ?? before the parameter displays the value and allows it to be changed.
Code:
Eval string = '?CHGSPLFA ?*FILE(' + %Trim(SplfName) + ')' +
                ' Job(' + %Trim(%EditC(JobNbr:'X')) + '/' + 
                 %Trim(JobUser) + '/' +
                 %Trim(JobName) + ') ' +
                 '??PRINTER(PRT01)'
will show the CHGSPLFA command as if you had done F4 with the FILE parameter filled in but protected. The PRINTER parameter has an initial value of PRT01 but it can then be changed to whatever is required.

PeteJ
(Contract Code-monkey)

It's amazing how many ways there are to skin a cat
(apologies to the veggies)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top