Executing IMS Commands
A COMMAND folder can be added to an IMS project to create and execute IMS type-1 and type-2 commands against an IMS connection.
Prerequisite: An IMS command connection must be configured in the IMS Connections view before you can run commands. If you have not done so already, see Creating IMS Connections.
Adding a command file
Command files hold the IMS commands you want to run. Each file is a plain-text file that you edit directly in VS Code.
- In the IMS Projects view, right-click the COMMAND folder inside your project.
- Select Add IMS Command File from the context menu.
- Enter a name for the file (for example,
db-status).
The new file opens in the editor immediately, ready for commands.
Tip: Create multiple command files to organize commands by task—for example, separate files for database commands, transaction commands, and program commands.
Writing commands
Both type-1 and type-2 IMS commands are supported. Write one command per file—the entire file contents are sent as a single command at execution time.
Type-2 commands (no leading /):
QUERY DB NAME(*)
Query the status of all IMS databases.
QUERY TRAN NAME(*)
Query the status of all transactions.
START DB NAME(MYDB)
Start a stopped database.
Type-1 commands (with leading /):
/DISPLAY DB ALL
Display the status of all databases.
/START DB MYDB
Start a specific database.
Note: One command per file. The entire file is sent as one command—you cannot run multiple commands in a single execution. You can clear the file and write a new command, or create separate files to keep each command available for reuse.
Running a command
Associating a connection
At the top of an open command file, a CodeLens line shows the current connection status. Click it to select an active IMS command connection for the file.
The CodeLens shows one of the following states:
- No IMS connection selected — click to pick a connection.
- <connection name> — a connection is set; click to change it.
Executing the command
With a connection selected, click the Execute CodeLens to run the command. You can also right-click the file in the IMS Projects tree and select Run IMS Command.
Viewing results
After executing a command, the IMS Command Output panel opens with three tabs:
| Tab | Content |
|---|---|
| Status | Return code, reason code, reason text, warning status, and elapsed time |
| Command Output | Structured table of the IMS response data |
| JSON Output | Formatted JSON response from IMS Connect |
Command history
Every executed command is saved in the Command History view. You can re-run past commands or review their output at any time—results persist across VS Code sessions.