IBM Support

Example of Using RUNRMTCMD in a CL Program to Run a PC Program

Troubleshooting


Problem

This document provides an example of using the RUNRMTCMD CL command in a CL program to run a program on a networked PC. The instructions in the example use SEU to create the source code for the CL program.

Resolving The Problem

Prerequisite

Verify interactively from an i5/OS command line that the RUNRMTCMD can successfully connect to the IRC running on the PC and run a Windows command such as "CALC.EXE".

In this example, the RUNRMTCMD CL command is used in a CL program to run a program on a networked PC. The instructions in the example use SEU to create the source code for the CL program. The source code is created in a member named MYRMTCMD of the QCLSRC file in library QGPL. Once the QCLSRC member has been created, the CRTCLPGM command is used to compile the source code and create a CL Program called MYRMTCMD in library QGPL.

The commands to create the CL program are run on the IBM OS/400 or IBM i5/OS command line.

Type STRSEU, and press F4 to prompt the command. Fill in the prompt screen as shown below. The Text description is optional.

Start Source Entry Utility (STRSEU) menu.

Press the Enter key. The following screen is shown:

Member MyRMTCMD added to file QGPL/QCLSRC. In Edit mode with blank lines;

Fill in the SEU input screen similar to the one shown below.

Entering initial lines of CL PGM, as well as RUNRMTCMD.

Press F4 to prompt the RUNRMTCMD. This will result in the following prompt screen. Fill it in similar to the one shown below.

The Command contains the path and name of the PC command, executable, or batch file that RUNRMTCMD will run. This example of RUNRMTCMD will run a PC batch file called transfer.bat that exists on the C:\ drive of the PC.

The Remote Location is the TCP/IP address of the PC where the PC command will run.

The Type is *IP.

The Remote user ID is the User ID on the PC where the PC command, executable, or batch program is to be run. It is not the IBM System i products user ID.

Prompted on CL command RUNRMTCMD (first page) from within SEU Edit screen.

Page down to the following screen. Type the password for the PC user ID typed above. Microsoft Windows platforms typically use case sensitive passwords. The IBM i defaults to sending the password in all uppercase. Therefore, if the PC password is lowercase or mixed case, enclose it with single quotes ( ' ) as shown in the screen below.

Prompted on CL command RUNRMTCMD (bottom page) from within SEU Edit screen.

Press the Enter key to return to the SEU entry screen. It will look similar to the following:

RUNRMTCMD displayed accross three lines in SEU Edit screen.

Type I5 (the letter I and the number 5) in place of the first two zeros on the line that starts with 0007.00 as shown below:

Inserting five new lines in the SEU Edit screen.

Press the Enter key, and the screen will display five additional input lines.

Five new lines displayed.

Fill in the input lines similar to the screen shown below.

Note: The lines that start with /* and end with */ are comment lines. The comments do not need to be included in the CL source that is being created. They should be replaced by actual steps that the CL program should take (if any). These steps might include steps like a creating a library (CRTLIB), creating a physical file (CRTPF), or might call other System i programs and so on.

Comments and ENDPGM added to CL program.
Press the Enter key to get to the following screen:

Pressed Enter after ENDPGM to complete the program, pressed F3 to Exit.

Press F3 to get to the Exit Screen.

On Exit screen, entered Y=Yes on Change/create member and pressed Enter to save the new CL program source.

Press the Enter key to save the new CL program source.

The CL program source must be compiled before the CL program can be run. Take the following steps to compile the new CL program.

Type CRTCLPGM on the operating system command line, and press F4 to prompt.

In the Create CL Program (CRTCLPGM) screen.

Fill in the prompt screen as shown below:

Under the Create CL Program (CRTCLPGM) screen entered MYRMTCMD for program, along with the rest of the parameters.

Press the Enter key to create the new CL program.

Message - Program MYRMTCMD created in library QGPL. - is displayed at the bottom of the screen.

The new CL program can be run from the command line or from the IBM i Scheduler. To run it from the command line, type the following command.

CALL PGM(QGPL/MYRMTCMD)

Press the Enter key.

[{"Product":{"code":"SWG60","label":"IBM i"},"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Component":"Data Access","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"7.1.0;6.1.0;5.4.5;5.4.0;5.3.5;5.3.0;5.2.0;5.1.0","Edition":"","Line of Business":{"code":"LOB08","label":"Cognitive Systems"}},{"Product":{"code":"SSC52E","label":"IBM i 7.1"},"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Component":" ","Platform":[{"code":"","label":""}],"Version":"","Edition":"","Line of Business":{"code":"","label":""}},{"Product":{"code":"SSC3X7","label":"IBM i 6.1"},"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Component":" ","Platform":[{"code":"","label":""}],"Version":"","Edition":"","Line of Business":{"code":"","label":""}},{"Product":{"code":"SSC5L9","label":"IBM i 7.2"},"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Component":" ","Platform":[{"code":"","label":""}],"Version":"","Edition":"","Line of Business":{"code":"","label":""}},{"Product":{"code":"SSTS2D","label":"IBM i 7.3"},"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Component":" ","Platform":[{"code":"","label":""}],"Version":"","Edition":"","Line of Business":{"code":"","label":""}}]

Historical Number

331039712

Document Information

Modified date:
18 December 2019

UID

nas8N1016200