Crt_log_data(Origin : Type : Category : level : event : logdata)
Origin = Origin (10A)
Type = Type (3A)
Category = Category (10A)
Level = Severity level (2,0P)
Event = Event (5,0P)
Logdata = A text string describing the log entry

Return type:
Unique logID number (11,0P)

Description:
This is a function that automatically generates an entry in the logging administration system and returns the id of the log entry.

Then some kind of event happens in the system, normally something that should not occur, a divide by zero or customer number not valid etc. you would normally have a program crash or just catch the error and display a “sorry” message on the screen. This will not change, but now then you catch an error you can send this into a log file, to be retrieved later in the administration menu.

The variables are designed “as is” but should be sufficient to self the mist demanding system.

Here is an example:

Crt_log_data (
‘Customer’
:’err’
:’calculation’
:99
:0001
:’Devide by zero detected in’
+ syspgm
+ ‘variables= customer:’
+ %char(custno)
+ ‘total:’
+ %char(total)
+ ‘months:’
+ %char(months)
)

This will create a log entry, with the specifications and a text the would look like this

“ Divide by zero detected in CSMA062R variables=customer:12234 total:4500 months: 0”

Use the INFDS and the FS_variables to insert informational values into the string.


Notes and Restrictions:
Date, time, user, server and site information is automatically logged. No need to use the variables of the function for this information.

iSeries2web uses the function to create many entries in the logging system, most are if there are problems with authorization etc.