Building command scripts

Use this information to learn how to build command scripts.

You might want to build the MQSC commands into a script when you use:
  • The CSQINP1, CSQINP2, and CSQINPX initialization data sets or the CSQUTIL batch utility on z/OS®.
  • The STRMQM command on IBM® i.
  • The runmqsc command on UNIX, Linux®, and Windows systems.
When you do this, follow these rules:
  • Each command must start on a new line.
  • On each platform, there might be platform-specific rules about the line length and record format. If scripts are to be readily portable to different platforms, the significant length of each line should be restricted to 72 characters.
    • On z/OS, scripts are held in a fixed-format data set, with a record length of 80. Only columns 1 through 72 can contain meaningful information; columns 73 through 80 are ignored.
    • On AIX®, HP-UX, Linux, IBM i, Solaris, and Windows, each line can be of any length up to a maximum of 2048 characters.
    • On other UNIX systems, each line can be of any length up to and including 80 characters.
  • A line must not end in a keyboard control character (for example, a tab).
  • If the last nonblank character on a line is:
    • A minus sign (-), this indicates that the command is to be continued from the start of the next line.
    • A plus sign (+), this indicates that the command is to be continued from the first nonblank character in the next line. If you use + to continue a command remember to leave at least one blank before the next parameter (except on z/OS where this is not necessary).
    Either of these can occur within a parameter, data value, or a string enclosed in quotation marks. For example,
    
       'Fr+
        ed'
    
    and
    
       'Fr-
    ed'
    
    (where the 'e' of the second line of the second example is in the first position of the line) are both equivalent to
    
       'Fred'
    

    MQSC commands that are contained within an Escape PCF (Programmable Command Format) command cannot be continued in this way. The entire command must be contained within a single Escape command. (For information about the PCF commands, see Introduction to Programmable Command Formats).

  • + and - values used at the ends of lines are discarded when the command is reassembled into a single string.
  • On AIX, HP-UX, Linux, IBM i, SolarisSolaris, and Windows you can use a semicolon character (;) to terminate a command, even if you have entered a plus sign (+) at the end of the previous line. You can also use the semicolon in the same way on z/OS for commands issued from the CSQUTIL batch utility program.
  • A line starting with an asterisk (*) in the first position is ignored. This can be used to insert comments into the file.

    A blank line is also ignored.

    If a line ends with a continuation character (- or +), the command continues with the next line that is not a comment line or a blank line.

  • When running MQSC commands interactively, you end the interactive session by typing the END command. This applies to:
    • UNIX, Linux, and Windows systems, where you start the interactive session by entering runmqsc
    • IBM i systems, where you start the interactive session from the WRKMQM panel
  • On Windows, if certain special characters such as the pound sign (£) and the logical NOT (¬) are used in a command script (for example, as part of an object description), they will be displayed differently in the output from a command such as DISPLAY QLOCAL.