Submit Remote Command (SBMRMTCMD)
|Where allowed to run: All environments (*ALL)
The Submit Remote Command (SBMRMTCMD) command sends a CL command through Distributed Data Management (DDM) to be run on the target system specified by a DDM file. The DDM file determines the communications line used, and indirectly identifies the target system that receives the submitted command.
This command sends only CL commands to a remote system which supports the SBMRMTCMD command language. It cannot send non-CL commands to a different system type (for example, OCL commands cannot be sent to a target System/36).
The primary purpose of this command is to allow a source system user or program to perform file management operations and file authorization activities on files located on a target system.
- Create or delete physical, logical, device, or source files
- Grant or revoke object authority to remote files
- Check, rename, or move files or other objects
- Save or restore files or other objects
- File processing on the target system operates independently of processing on the source system. Commands dependent on a specific recursion level or request level may not function as expected.
- Output (such as spooled files) generated by a submitted command exists only on the target system. The output is not sent back to the source system. Therefore display commands or commands that are used to service programs should not be sent because the output results remain at the target system.
- Translation is not performed for impromptu messages caused by target system errors, because they are not stored on the system; the text for an impromptu message is sent directly to the source system and displayed. The message identifier of all other message types generated on the remote system is sent back to the source system. The message text that exists for the message identifier on the source system is displayed as it would be for the same error on the source system.
- A maximum of 10 messages, generated during the running of a submitted command, can be sent by the target system to the source system. If more than 10 messages are generated, an additional informational message is sent that indicates that the messages exist in the job log for the target job on the target system. If one of those messages is an escape message, the first nine messages of other types are sent, followed by the informational message and the escape message.
- In multithreaded jobs, this command is not threadsafe and fails for DDM files of type *SNA.
|CMD||Command to run||Character value||Required, Positional 1|
|DDMFILE||DDM file||Qualified object name||Required, Positional 2|
|Qualifier 1: DDM file||Name|
|Qualifier 2: Library||Name, *LIBL, *CURLIB|
Command to run (CMD)
Specifies a character string of up to 2000 characters that represents a command that is run on the target system. The command must be allowed in both batch and interactive environments on the target system. The command must be enclosed in apostrophes if it contains embedded blanks or special characters. The command must use the syntax of the target system.
This is a required parameter.
Note: The normal rule of pairing apostrophes in quoted strings on the local system must be doubled when the same string is submitted to a remote system. This is required to allow coding a quoted string within another quoted string.
DDM file (DDMFILE)
Specifies the name and library of the Distributed Data Management (DDM) file that is used to submit the command to the target system. The DDM file is used only to determine the remote location representing the target system. The remote file name associated with the DDM file is ignored by this command.
This is a required parameter.
The possible library values are:
- The library list is used to locate the file.
- The current library for the job is used to locate the file. If no library is specified as the current library for the job, the QGPL library is used.
- Specify the library where the file is located.
Example 1: Deleting a File
SBMRMTCMD CMD('DLTF LIBX/FRED') DDMFILE(DENVER)
This command deletes the file named FRED in library LIBX on the target system that is associated with the DDM file named DENVER.
Example 2: Creating a Physical File
SBMRMTCMD CMD('CRTPF SALES/CAR QGPL/QDDSSRC MASTER') DDMFILE(DENVER)
This command creates the physical file CAR in library SALES using the data description specifications (DDS) in the source file QDDSSRC and source member named MASTER in the QGPL library. The DDS must already exist on the target system identified by the DDM file named DENVER in the target job's library list.
Example 3: Changing the Text Description
SBMRMTCMD CMD('CHGDDMF FILE(LIBX/STANLEY) TEXT(''Don''''t forget to pair apostrophes.'')') DDMFILE(SMITH)
This command changes the text in the description of the DDM file named STANLEY which is stored in library LIBX. Because the submitted command requires an outside set of single apostrophes (for the CMD parameter), each single or double apostrophe normally required in the TEXT parameter for local system processing must be doubled for remote system processing. The coding above produces a single apostrophe in the text when it is shown or printed on the remote system.
Example 4: Creating a DDM File
SBMRMTCMD CMD('CRTDDMF FILE(SALES/MONTHLY) RMTFILE(*NONSTD ''CAR.SALES(JULY)'' RMTLOCNAME(DALLAS)') DDMFILE(CHICAGO)
This command creates (on the target system identified by the information in the DDM file named CHICAGO) another DDM file named MONTHLY. The new DDM file is stored in a library named SALES on the CHICAGO system. The new DDM file on the CHICAGO system is used to access a file and member on a different system named DALLAS. The accessed file is named SALES/CAR and the member name in the file is JULY.
Note that this CRTDDMF command string contains three sets of single apostrophes: one set to enclose the entire command being submitted, and a double set to enclose the file and member named in the RMTFILE parameter. This is how any i5/OS file member name must be specified on the SBMRMTCMD command, because of the parentheses needed to enclose the member name.
Example 5: Replacing a Portion of the Library List
SBMRMTCMD CMD('RPLLIBL LIBL(QGPL QTEMP SALES EVANS)') DDMFILE(EVANS)
This command replaces the user's portion of the library list being used by the target job associated with the DDM file named EVANS, which is being used by the source job in which this SBMRMTCMD command is being submitted. In that source job, if there are other open DDM files that specify the same device and mode, this library list is used for them also.
- Target system does not support SBMRMTCMD.
- File &1 in library &2 not a DDM File.
- Error occurred on distributed file.
- Target system &3 not available.
- SBMRMTCMD command ended abnormally.
- Error on call to user exit program on target system.
- Error during processing of user exit program.
- User exit program did not complete successfully.
- Processing of the command specified by SBMRMTCMD failed.
- Cannot start DDM communications.