How can I write to the system log without defining all the messages in the dictionary?

Document ID : KB000022575
Last Modified Date : 14/02/2018
Show Technical Document Details

Question: 

I would like to write to the system (z/OS) log from an IDMS user program using #WTL (assembler) or WRITE LOG (COBOL). They require you define the message in the message area of the dictionary first. Is there a way to write to the system log without defining the messages in the dictionary?

 

Answer: 

To write to the system log you will need to use the #WTL macro or WRITE LOG command and they do require that the message be pre-defined in the dictionary.

If you have many messages to display and you don't want to define all the messages in the dictionary you could just define one message and pass the whole message text as a parameter. The only drawback is that all messages will have the same message id. The message should be defined like this:

ADD MESSAGE DC999888        
TEXT LINE 1 
DESTINATION IS OPERATOR.
SEVERITY IS 0
MESSAGE IS '&01'.

When specifying the parameter in the program, the first byte is the length of the parameter. User programs can use message ids above DC900000. Alternatively you could use a different prefix to the default of 'DC', in which case you could use any message number. You could for example define message IM999888 in the dictionary. In the assembler #WTL you need to code MSGPREF='IM' or in COBOL code MESSAGE PREFIX is 'IM' so that the program will use message id IM999888.