MDADDCMD - Add MDCMS Command command
MDCMS is delivered with a command-based API that allows external tools or applications to add commands to the MDCMS configuration for specific object requests, future object requests, attributes, any RFP for a level or for a specific RFP.
If successful, the additional command will be visible in the appropriate location based on the context and will run at the point in the process dictated by the Command Type.
The MDCMS command is named MDADDCMD and is located in library MDCMS. It is not necessary to have the MD libraries in the library list prior to using this command.
All MDADDCMD API transactions are logged to file MDCMS/MDDACMD.
If trying to add a command to an object request, the APPL, LVL, OBJT, ATTR, OBJN and USER values must be identical. The RPTH, RFP, RFPD or REQN parameters can be used to uniquely identify the request in case multiple requests for the same object name and type could exist.
MDADDCMD Parameter Table
| Column 1 | Column 2 | Column 3 |
|---|---|---|
| KEYWORD | Label | Description |
| APPL | Application | The application code for the application that the command will be added to |
| LVL | Level | The MDCMS Promotion Level within the application |
| CMD | Command | The command string to be added. The string may be up to 640 characters in length. Note - it is recommended to avoid using hardcoded library names in the string. Instead, use placeholder ##OBJLIB##. |
| CMDC | Command Context | Specifies the context for the command, as in which level in the configuration hierarchy that the command should be added. *OBJECT The command is added to a specific object *ATTRIBUTE The command is for an object attribute, such that it will be executed for any object request of the given attribute, unless overriden by an object-level command. *LVLRFP The command is executed once per RFP for the given level. The command can be viewed/edited from within attribute commands for attribute *RFP. *SPECRFP The command is added to a specific RFP number. |
| CMDT | Command Type | The Command Type, which specifies at which point in the deployment process that the command is invoked. If not specified, the default of C=Compile is used. |
| OBJT | Object Type | The object type for the application, level and attribute. For example: *PGM for a program or *IFS for an IFS file. Only relevant for *OBJECT and *ATTRIBUTE command contexts. |
| ATTR | MDCMS Attribute | An existing Attribute code for the application level. Only relevant for *OBJECT and *ATTRIBUTE command contexts. |
| OBJN | Object Name | A valid Object name based on the Object Type. For *SOURCE, this would be the name of the member For *MSGD, this would be the name of the Message ID For *DTAGRP, this would be the value of the record key(s) Only relevant for *OBJECT and *ATTRIBUTE command contexts. |
| CMDO | Command Option | The Command Option determines what should happen to any commands that are already defined for the same context and command type. Note - Only one Data Copy command is permitted per Object. All other types allow up to 999 commands. *ADD The command will be appended to the end of the list of commands that will run for the context and command type, so that the command runs after any already defined command. *REPLACE The command will replace any commands already defined for the context and command type. Commands defined for a different command type will not be removed. |
| IGNE | Ignore Errors | Specifies if the RFP process should continue if an error occurs during the execution of the Object command. Note - certain command errors are automatically ignored because the exit point is outside the scope of an RFP in the process of installation. A warning will be generated, though. *YES any error that occurs will cause a warning condition to occur, but the RFP will continue with the deployment process. *NO MDCMS will end processing and roll back the RFP to the state it was in prior to beginning of the deployment step. |
| KEEP | Keep MD Libs in Libl | Specifies if the MD libraries (MDCMS, MDXREF, and MDSEC) should remain in the library list during the execution of the command. *NO the libraries will be removed from the library list to avoid allocation of MD objects that are named the same as objects in your application. *YES The libraries will remain in the library list, which is important if the command is an MD command. |
| REUS | Reuse Command | Specifies if the command should automatically reattach to the object the next time that the object is requested for the same application and level. This parameter is only relevant for context *OBJECT *YES The command should be reused for future versions of the object *NO The command is to be used this time only *DEF The command is only to be applied as a definition for future requests of the object and shouldn't be applied to a current object request. The definition can be viewed/edited from the Object Commands settings. |
| WCRD | Placeholders in SQL Script | Specifies if MDCMS should inspect the SQL script for placeholders and replace them with the runtime execution values. This flag is relevant when the command RUNSQLSTM is used and the SQL script is stored in either a source member or in an IFS file. *NO The script doesn't contain placeholders or the command isn't RUNSQLSTM *YES The RUNSQLSTM command is defined and placeholders need to be replaced in the script. |
| RLOC | Location to Run Command | Specifies which locations the command should be on, at the time that an RFP containing the command runs at that location. *ALL The command should run at every location that the RFP containing the command deploys to. *LOCAL The command should only run on this system and will not be distributed to other locations. *LOCLVL The command should only run on this system for this level and nowhere else. *REMOTE The command should not run on this system, but should for every system that the RFP is distributed to. location The Location ID of a specific system that the command should run on when the RFP is deployed on that system. Note: this parameter is only relevant for *OBJECT and *SPECRFP contexts |
| RUSR | Run as User Profile | Specifies the user profile to use when executing the command. *USER the user profile of the job that is running at the time that the command is executed. character-value a valid User Profile name. The profile will be saved with the command definition only if *USE authority is enabled for the invoker of MDADDCMD. |
| USER | Programmer | Specifies the user profile to whom the object request is assigned *USER the current user profile of the job invoking this command is the user character-value a valid User Profile name. The command will only be attached to the object if the request user is that same value. Note: this parameter is only relevant the *OBJECT context |
| RPTH | Object Relative Path | Specifies the relative portion of an IFS or REMOTE path for the object. This is in case multiple objects of the same name are in different folders, so that MDCMS can add the command to the appropriate object. This is only relevant for the *OBJECT command context. |
| RFP | Existing RFP Number | Specifies the RFP that the Object Request is assigned to, in case multiple objects of the same name are currently requested at the same level. Or, the specific RFP for a command to be added directly to an RFP. |
| RFPD | RFP Description | Specifies the description of the RFP that the Object is currently assigned to, in casemultiple objects of the same name are currently requested at the same level. Or, for adding a command directly to an RFP. |
| REQN | Request Number | The Request Number to uniquely identify the Object to add the command to, if known. |
| MOD | Run for Modifications | If command is for an attribute, it can be selectively run or not when an object of the given attribute is requested for Modification. This includes when the request reason is for a new object. *YES The command should be run when an object is requested for Modification *NO The command should be skipped when an object is requested for Modification |
| RCMP | Run for Recompiles | If command is for an attribute, it can be selectively run or not when an object of the given attribute is requested for Recompile. *YES The command should be run when an object is requested for Recompile *NO The command should be skipped when an object is requested for Recompile |
| DEL | Run for Deletions | If command is for an attribute, it can be selectively run or not when an object of the given attribute is requested for Deletion. *YES The command should be run when an object is requested for Deletion. *NO The command should be skipped when an object is requested for Deletion. |
| UPD | Run for Updates | If command is for an attribute, it can be selectively run or not when an object of the given attribute is requested for Update. *YES The command should be run when an object is requested for Update. *NO The command should be skipped when an object is requested for Update. |
| FREQ | Execution Frequency | Depending on the Command Context, options are available for the frequency that a specific command is executed for an RFP. *OBJECT If adding a command to an attribute, *OBJECT indicates that the command should run once for every object in the RFP of the given attribute. This value is ignored for other command contexts. *RFP If adding a command to an attribute, *RFP indicates that the command should run once for an RFP if at least one object is requested in the RFP for the given attribute. If multiple objects of the given attribute are in the RFP, it will only run for the first object, based on the sort sequence of the objects. This value is ignored for other command contexts. *BATCH If adding a command of command type 5 (Pre-Send), 6 (Post-Send) or 7 (Send Error), the value of *BATCH indicates that the command will be executed once per Send of a batch of locations. This value is ignored for other command contexts. *LOC If adding a command of command type 5 (Pre-Send), 6 (Post-Send) or 7 (Send Error), the value of *LOC indicates that the command will be executed once for every target location/level in the batch of a Send process. This value is ignored for other command contexts. |
| ENV | MDCMS Environment ID | Specifies the MDCMS environment that the Object Request exists in. The ID correlates to the suffix of the MDCMS library name. *DFT The default environment will be used. This correlates to library MDCMS. character-value A specific environment for MDCMS. For example, TEST correlates to library MDCMSTEST. |
| VREF | Vendor Reference ID | Specifies the Vendor Generated Identifier in order for an external process to easily identify the transaction record in the MDDACMD table. character-value A string of up to 20 characters used to identify this transaction |
| EMSG | Exception Message | Specifies if and to what extent an exception message should be returned to the calling program. An exception message occurs when an input parameter value is invalid, causing the add of the request to fail. *DIAG A diagnostic message will be placed in the calling program's message queue in the following format: MDADDCMD Exception. Object= Reference= If not for *OBJECT context, the object won't be in the message If the Vendor Reference isn't passed to MDADDCMD, it won't be included in the diagnostic message. *ESCAPE The full diagnostic message as described above will be placed in the calling program's message queue and then followed by escape message CPF0001 for which the calling program can monitor. *NONE An exception message will not be returned to the calling program's message queue. . |