run a ‘.bat file’ with an AS400 function key

115 pts.
.bat file
AS/400 Function Keys
I am trying to run a windows '.bat file' using an as400 function key. I have no knowledge of how to make the AS400 asign the fuction key ie F2 to the run the '.bat file'. Anyone have an idea. I have searched IBM's database and also quizzed my service providers and have received blank stares. Help would me much appreciated. Thank you in advance.

Software/Hardware used:
IBM AS400 and Windows xp or 95

Answer Wiki

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

One way is to use the RUNRMTCMD command. In your application program test for F2 being used. If it is, then run the RUNRMTCMD command. RUNRMTCMD CMD(‘C:\DOCUME~1\BRUCEV~1\LIST.BAT’) RMTLOCNAME(‘’ *IP) RMTUSER(‘MyUser’) RMTPWD(‘yyyyyyy’) for instance will run the bat file LIST on the PC at IP address using a Windows user id of MyUser and a password of yyyyyyy.

There are several other ways, but this is probably the easiest.

Discuss This Question: 6  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.
  • Rajgoaj
    Superbru, F2 can be used from your application only, I dont think there is a way to override the F2 key in OS400...... If it is in the application, then RUNRMTCMD, STRPCO & STRPCCMD will also help. Somebody correct me I am wrong.
    280 pointsBadges:
  • superbru43
    Thanks for your answers guys. I managed to sort my problem. The reason I was doing this excercise was to have cash till pop open with the function key. It would seem you cannot override the F2 key so now I just need to write it to my invoice program and it will open after dunning the CL I have found and manhandled, which works. *************** Beginning of data ******************************** PGM DCL VAR(&URL) TYPE(*CHAR) LEN(123) + VALUE('"C:till.bat"') DCL VAR(&STRCMD) TYPE(*CHAR) LEN(123) STRPCO PCTA(*NO) MONMSG MSGID(IWS4010) CHGVAR VAR(&STRCMD) VALUE('C:TILL.BAT') DMPCLPGM STRPCCMD PCCMD(&STRCMD) PAUSE(*NO) ENDPGM: ENDPGM ****************** End of data *********************************** The CL pops the till neatly when called. Thanks again
    115 pointsBadges:
  • amanagrawal003
    can we do automation of call command using .bat file.....plz let me know how.......

    need :- click on batch file so directly it can help me to run call command inside as400 without login....batch file should be on desktop
    10 pointsBadges:
  • mmanley
    We use a CL program to start a browser session, and pass to it a parameter from the AS/400.  We pass the job name.  Here's the CL we use
    You could substitute any PC program, but we're launching FireFox
    STRPIIM: PGM                                                            
                 DCL        VAR(&CMD) TYPE(*CHAR) LEN(256)                  
                 DCL        VAR(&JOB) TYPE(*CHAR) LEN(10)                   
                 DCL        VAR(&JOBE) TYPE(*CHAR) LEN(30)                  
                 CALL       PGM(GSEXE/SETLIBL)                              
                 RTVJOBA    JOB(&JOB)                                       
                 CALL       PGM(URLENC) PARM(&JOB &JOBE)                    
                 CHGVAR     VAR(&CMD) +                                     
                              VALUE('C:\PROGRA~1\MOZILL~1\FIREFOX.EXE +     
                              SID=' *TCAT &JOBE)                            
                 MONMSG     MSGID(IWS4010)                                  
                 STRPCCMD   PCCMD(&CMD) PAUSE(*NO)                          
    470 pointsBadges:
  • TheRealRaven
    On the PC side, the RUNRMTCMD function is generally done by running the rexec utility command. To see if you have it installed, just type rexec in a command window. If it's not found, you'll need to install it.

    If iSeries Access is installed on the PC, perhaps the most common method is with the rmtcmd command. Enter the command in command window to see if that iSeries Access option is installed.

    Various rexec utilities can be found that do a rexec function. Internet searches let you choose one that fits your environment.

    Because rexec can be insecure, it's often inappropriate in many networks. Functions such as a ssh client make it much harder to sniff elements such as passwords. Unfortunately, ssh requires more setup work in order to get it working, and setup is required on both ends.
    36,975 pointsBadges:
  • ToddN2000
    @amanagrawal003: regardless of what you do, any connection to the AS/400 will require login credentials, FTP, ODBC and Client Access. If you can provide more specific details on the job you are trying to do we may be able to give you a good solution.
    136,410 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: