ONLYIF command: Running commands in ARCCMDxx conditionally

The ONLYIF command allows a single command or group of commands contained within a BEGIN ... END block, immediately following the ONLYIF command, to be run conditionally depending on the host specified. An ONLYIF command cannot follow another ONLYIF command and it cannot be nested within a BEGIN ... END block.

Text on the line immediately following an ONLYIF command is run as the conditional command. That is, if the line is blank or commentary, it is considered the command to be run. For example, the comment after the ONLYIF command is considered for processing, not the command (command1). The command applies to all hosts.
 ONLYIF HSMHOST(hostID1)
 /* The following command is issued on all hosts. */
 command1
To avoid this error, use a continuation character to join the comment to the command. For example:
 ONLYIF HSMHOST(hostID1)
 /* The following command is issued on hostID1 only. */ +
 command1
Or, surround multiple lines with BEGIN and END. For example:
 ONLYIF HSMHOST(hostID1,hostID2)
 BEGIN
   /* The following commands are issued for hostID1 and hostID2 only. */
   command1
   command2
 END	

Related reading

For more information about the commands you can specify in the DFSMShsm SYS1.PARMLIB member ARCCMDxx, see z/OS DFSMShsm Implementation and Customization Guide.