Share this page

# Use the scripting interface shell

This topic explains how to use the dmpmcli scripting interface, describes its syntax and properties, and provides examples of dmpmcli commands.

In this topic:

## Run the shell

To run the scripting interface shell, open your command prompt and enter dmpmcli.

Back to top

## dmpmcli syntax

The shell has the following syntax:

Copy code

    dmpmcli
    [-user <username>
    -pass <password>
    -dbname <database>
    -host <server>
    -dsn <dsn-name>
    ]
    [-param <parameter file>
    [-file <script file> [<script arguments>]]
    [-help]
    [-version]

where:

Parameter | Description
--- | ---
`-user <username>` | Specifies a user ID that is registered on the OpenText Dimensions CM base database.
`-pass <password>` | Specifies the password for the user ID that you entered above.
`-dbname <database>` | Specifies the name of the base database.
`-host <server>` | Specifies the name of the OpenText Dimensions CM server. The <server> string may explicitly specify the port number of the OpenText Dimensions CM Listener, for example: `-host servername:5555`
`-dsn <dsn-name>` | Specifies the connection string that enables you to connect to the database server for your Dimensions base database.
`-param <parameter file>` | Specifies a file with connection parameters. For an example, see Specify connection parameters in a file.
`-file <script file> [<script arguments>]` | Specifies a file with a script to run, and the script's (optional) arguments.
`-help` | Displays the help for the dmpmcli syntax.
`-version` | Displays the version of dmpmcli that you are running.

Before the specified javascript source runs, the following actions take place:

- dmpmcli overrides and specifies its own custom error reporting.

- OpenText Dimensions CM defines the additional non-ECMA global javascript functions:

  Copy code

      system
      source
      run
      print
      quit
      version
      help
      exit

- The variable "arguments" are populated with the specified command-line arguments.

Specify connection parameters in a file

You can specify the connection parameters in a file rather than in the command line, for example:

Copy code

    -user dmsys
    -pass <password>
    -dbname intermediate
    -host server1
    -dsn PC50

Run scripts

You can use the `-file` option to specify a file containing a JavaScript script that is to be run.

If you do not specify a script, the interpreter enters interactive mode, and the script source is read and run from standard input until an EOF (End of File) character is detected (CTRL+Z on Win32 platforms and CTRL+D on UNIX platforms), or until you run the `quit()` or `exit()` functions.

Back to top

## Examples of using dmpmcli

Use these examples to help you work with dmpmcli.

Example 1. Enter interactive mode:

Copy code

    dmpmcli -user dmsys -pass <password> -dbname intermediate -dsn PC50 -host dimhost

This command connects to the OpenText Dimensions CM server node dimhost and enters interactive mode. To quit dmpmcli, use the `quit()` or `exit()` functions.

Example 2. Run a script:

Copy code

    dmpmcli -user dmsys -pass <password> -dbname intermediate -dsn PC50 -host dimhost:5555 -file /home/dmsys/script/setupAttributes.js

This command connects to the OpenText Dimensions CM server node dimhost (assuming that the OpenText Dimensions CM Listener is listening on port 5555) and runs the following script:

/home/dmsys/script/setupAttributes.js

Example 3. Read connection information from a file:

Copy code

    dmpmcli -param /home/dmsys/connection.data -file /home/dmsys/script/setupAttributes.js

This command connects to the OpenText Dimensions CM server node identified by the connection information in the /home/dmsys/connection.data file, and runs the following script:

/home/dmsys/script/setupAttributes.js

Back to top

## Predefined properties

Scripts running in the dmpmcli shell have access to the following predefined top-level object properties:

Command | Description
--- | ---
`arguments` | An array containing the strings of all the arguments given at the command line when the shell was invoked.
`help()` | Displays usage and help messages.
`defineClass(className)` | Defines an extension using the Java class named with the string argument. Uses ScriptableObject.defineClass()
`run(["foo.js", "arg0", ...])` | Runs the JavaScript source file specified by the first string in the argument, and passes the remaining arguments as that script's arguments. The parent environment is visible but cannot be modified.
`source(["foo.js", "arg0", ...])` | Runs the JavaScript source file named by the first string in the argument, and passes the remaining arguments as that script's arguments. The parent environment is visible and can be modified.
`system(["cmd", ...])` | Runs one or several native OS commands specified by the string argument.
`loadClass(className)` | Loads a class named by the string argument. The class must be a script compiled to a class file.
`print([expr ...])` | Evaluates and prints expressions.
`quit()` `exit()` | Quits the shell. The shell also quits in interactive mode if you enter an EOF character at the prompt.
`version([number])` | Gets or sets the JavaScript version number.

Back to top

See also:

- Use the object model
- Example dmpmcli scripts

https://admhelp.microfocus.com Dimensions CM 8942
Tips to improve your search results... OpenText™ Dimensions CM Help Center OpenText™ Dimensions CM Help 25.2 All View Local Help Center View Online Help Center Version: