The message-id on the WRITE LOG statement is always interpreted as a seven-digit number.
If you code a message-id which has fewer than seven digits, then the number will be interpreted by the system as a seven-digit number with zeroes padded on the left.
The message-code issued will be the first six digits of that seven-digit message-id.
The severity used will be the last (seventh) digit. This severity is only used if the message is not found on the dictionary at run time.
For example, if you specify message-id 9876543, then that will be interpreted as message-code 987654 with severity 3.
If you specify message-id 987654, then that will be interpreted as 0987654 so the message-code will be 098765 and the severity 4.
If you specify message-id 98765, then that will be interpreted as 0098765 so the message-code will be 009876 and the severity 5.
The severity can have serious consequences for the system behaviour, for example, 8 or 9 will abend the CV.
All the severities are documented in the WRITE LOG and #WTL links below.
Note: Optional bit 321 changes the behaviour such that severity 0 is always used when the message is not on the dictionary, regardless of what is passed on the WRITE LOG statement.
on r18.5, RO94133
for z/VSE) changes the behaviour of bit 321 such that it only changes the severity to 0 if the original severity on the message-id in the statement was 8 or 9.