Use the RBCDLTHST command. This command has multiple parameters including the age to purge and the maximum severity to purge.
Note: The parameters are case-sensitive and need single quotes around them.
Purge records over days old: The value you enter must be three digits in length. If '007' is entered, then all history from today is kept, as well as all history starting from midnight seven days ago. The minimum value is '001' , the max value is '999'.
Remove Reply Messages: All Informational messages (that meet the selection criteria) will be removed from message history. In addition, these informational messages are also removed from the Message Queues and Message Centers. If '*YES' is entered (or 'Y' if you're calling RBC596), all answered Inquiry messages (that meet the selection criteria) are removed from message history. Unanswered Inquiry messages are NOT removed from the Message Queue or Message Center.
Maximum severity to purge: Enter a message severity level (00-99) that would be the maximum severity to be purged. For example, setting this parameter to '40' would clear only messages that have a severity of 40 or less. To clear all messages (that meet the selection criteria), set it to '99'.
System records to purge: This parameter is useful only if using Robot Network. Setting it to *ALL ( or ' ' (blank) if you're calling RBC596) clears messages from all systems. A specific system in the network can be specified instead - this clears only messages coming from that system.
Remove Response Required: Specify if you want to remove response required messages that have not been responded to. Enter Y if you would like to purge records for messages that still require a response. Enter N if you would not like to purge messages that still require a response.