This constraint is easy to formulate - it is valid for all instances without any content related dependencies.
Therefore we use the element <DCI-RULE/XSD-MAX-LENGTH> and place the value 31 in.
It is no problem to include this requirement into the DTD - mark the subject element as mandatory.
But we want to go one step further and offer the user more convienence - that means only when the user wants to send the mail, the subject is required, but not when he wants to store the mail as draft.
But let's start:
Define this rule from normal words up to dedicated xpath statements:

in "normal" wording
If the mail is ready to send, then a subject must be present.
with xml-words
If the element <status> has the value "ready to send", then the email must have a <subject> element.
with xpath-statements
If the xpath-expression '//status[="ready to send'] returns true, then the xpath-expression '//subject' must return a non-zero value.
with the msr-dci

This constraint is combined with external data-resources which are not defineable in DTD's or schemas. To cover such situation with the DCI, 2 elements allow the integration of thus external resources - DCI-PROC-CALL and DCI-SCRIPT. Both have the possibility to execute program code and have with it the access to free defineable resources - as long as program code exist, which can access it.
In the example we use a com-component, which can execute sql-statements.