×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
If you would like to share a working example that would be appreciated.
This is the SQL statement fyi
QAUDStmt = 'SELECT journal_entry_type, +
syslog_facility, +
syslog_severity, +
syslog_event +
FROM TABLE +
(QSYS2.DISPLAY_JOURNAL(''QSYS'',''QAUDJRN'', +
GENERATE_SYSLOG => +
''RFC5424'', +
STARTING_TIMESTAMP => ? +
)) AS X +
WHERE syslog_event IS NOT NULL +
and substr(syslog_event,105, 3) <> ''Low''';
Thank you
Don
From: "Tim Fathers" <tim@xxxxxxxxxxxxx>
To: "Midrange Systems Technical Discussion"
<midrange-l@xxxxxxxxxxxxxxxxxx>
Cc: "Don Brown" <DBrown@xxxxxxxxxx>
Date: 02/11/2021 06:42 AM
Subject: Re: SQL Prepare question
Hi Don,
The SQL isn't included, but I would guess the prepare isn't necessary at
all and the select statement could just be added as part of the DECLARE
CURSOR with host variable(s), which would stay inside the loop, that way
you get syntax checking too. I would also put the messy SQL bits in
procedures, such as Open(...), Read(...) and Close(...), which I think
makes it look more readable:
dow process <> 'STOP';
OpenLog(startTime);
dow ReadLog(desc);
// do something...
enddo;
CloseLog();
enddo;
A general-purpose SQL error checker procedure is also handy, which can be
called after each SQL statement. Below illustrates the structure I usually
use. Also, consider fetching a set of rows on each SQL fetch, this will
speed up the process considerably. I usually hide this implementation
inside the Read(...) procedure, such that it reads a set of rows and
passes one back on each call until that set is exhausted and it reads
another set. I can post an example of that if it would help.
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> on behalf of Don
Brown via MIDRANGE-L <midrange-l@xxxxxxxxxxxxxxxxxx>
Sent: 01 November 2021 20:16
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxxxxxxxx>
Cc: Don Brown <DBrown@xxxxxxxxxx>
Subject: RE: SQL Prepare question
Thanks Rob,
I am reading the audit journal - don't think I can attach a trigger ?
Yes I have a properly prepared SLQ statement in SQLStmt.
So you are saying I can omit the Prepare and Declare in the loop - only
need them once ?
Thanks
Don
From: "Rob Berendt" <rob@xxxxxxxxx>
To: "Midrange Systems Technical Discussion"
<midrange-l@xxxxxxxxxxxxxxxxxx>
Date: 01/11/2021 09:17 PM
Subject: RE: SQL Prepare question
Sent by: "MIDRANGE-L" <midrange-l-bounces@xxxxxxxxxxxxxxxxxx>
Since you're using "open using" you probably have a properly prepared sql
statement. With that in mind you probably do not need your prepare or
declare statements within your loop.
But from a higher level I would question why not a trigger or some other
technique.
Rob Berendt
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact
[javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.