Highlighted
Absent Member.
Absent Member.
503 views

[archive] Write to runtime error log

[Migrated content. Thread originally posted on 16 February 2007]

Ability to quickly write to the runtime error log file programatically with a new library routine like C$LOG or something.

This would be especially useful for Quality Assurance testing.
0 Likes
4 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] Write to runtime error log

Does it have to be the runtime log file? Would the system log be ok?


ACUCOBOL-GT Appendices
Version 7.2

Appendix I: ACUCOBOL-GT Library Routines > I.1 Library Routines >
C$SYSLOG

This library routine can be used to open, write to, and close the system log. Using this routine, you can write to the system log or event notification system (on Windows) in the event of a serious error that administrators need to know about.
Usage

CALL "C$SYSLOG"
USING OP-CODE, parameters

Parameters

OP-CODE Constant

Indicates which C$SYSLOG operation to perform. The operations are described below in the Description section.

parameters vary depending on the op-code chosen

Provide information and hold results for the operation specified. These parameters are discussed with their corresponding op-codes in the Description section below.
Description

C$SYSLOG sends messages to syslog on UNIX systems that have the syslog function. On other UNIX systems, and on other non-Windows operating systems, this routine sends messages to the console. On Windows systems, the routine sends messages to the event log, which can be viewed using the Event Viewer applet available on Windows.

The runtime also sends messages to the system log when it detects broken files. This function allows COBOL programmers to notify system administrators automatically when a broken file is detected, instead of relying on individual users to report such errors. The runtime sends such notifications only if the COBOL program has opened the system log using the C$SYSLOG routine as described below.

Note: Because the various implementations of system logging don't report errors, the C$SYSLOG routine does not report errors either, because it never receives any.

See your UNIX system documentation for information about the syslog facility. Refer to your Windows documentation for information on the Event Viewer applet.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Write to runtime error log

I was aware of C$SYSLOG, but I would like to be able to insert my own messages into the runtime log file so that they are in sequence, and in the same location, with what the runtime traces. For instance, just before, or after, a particular traced IO statement is traced by the runtime, I would like to add additional information to the log.

Beyond that I would simply like to quickly log whatever I like, for instance, my own variable watching and paragraph and section stepping logging, etc. These could act as markers in my logs so that I more quickly know where I was, and what the data and program state was when a runtime logged(or my own logged) entry was made.

Right now I write my own testing log files, but they don't include what the runtime traces, so I have to read and attempt to manually synchronize seperate logs. I would much rather write to the runtime log file and have things synchronized in one place.

Am I alone on this one?
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Write to runtime error log

You can do this by declaring in the SPECIAL-NAMES paragraph:

SYSERR IS SYSERR

and then in the Procedure Division use the DISPLAY ... UPON SYSERR syntax.

For example:

DISPLAY "I am here" UPON SYSERR.

This will cause the message "I am here" to be display in the error file (i.e. the file specified with the -e {filename} on the command line).
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Write to runtime error log

We've used the DISPLAY ... UPON SYSERR statement extensively and we've never had to declare it in the SPECIAL-NAMES paragraph.

That's on Unix platforms.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.