Hi there,
I'm trying to read (browse) from a Systemlogger with Java. I found the wrapper Class ZLogstream. But there is no sample from IBM how to read with this class.
Can someone give me a sample, which makes things such easier for me?
I found out, that the constructor makes a Connection to the Logstream. But how should I go on..? Thanks in advance.
Sample for Read from Systemlogger via ZLogstream
-
- Global moderator
- Posts: 3720
- Joined: Sat Dec 19, 2009 8:32 pm
- Skillset: Systems programming, SAS, COBOL, CICS, JCL, SMS, VSAM, etc.
- Referer: other forum
- Location: Dubuque, Iowa, USA
Re: Sample for Read from Systemlogger via ZLogstream
To make a connection to a logstream, you MUST know the name of it. How do you find the name? Since each and every site can define its own logstream name, you have no choice but to contact your site support group and find out the name of your site's logstream. Then you connect to it, assuming you have appropriate security, and then use the appropriate method to search / browse / whatever the logstream.
Re: Sample for Read from Systemlogger via ZLogstream
Well the connection is not the problem. I know the name of the Logstream and yes the connection is successful.
Look at my source
My problem here is that I get no useful information in the Field 'buffer'. In the debugger I values such 0, -15 or something like that. But not printable value, which I can cast to characters.
What should I do here?
Look at my source
Code: Select all
//get Timestamp
long unixTimestamp = Instant.now().getEpochSecond();
RecordReader reader=null;
int bytesRead =0;
System.out.println("Hallo Welt");
ZLogstream myStream = new ZLogstream("MTLOGGER.TEST.MTPPS");
//get Maxium Buffer
byte[] buffer=new byte[myStream.getMaxBlockLength()];
myStream.browseStartSearch(false,unixTimestamp);
bytesRead=myStream.readSearch(unixTimestamp, buffer, 0);
My problem here is that I get no useful information in the Field 'buffer'. In the debugger I values such 0, -15 or something like that. But not printable value, which I can cast to characters.
What should I do here?
-
- Global moderator
- Posts: 3720
- Joined: Sat Dec 19, 2009 8:32 pm
- Skillset: Systems programming, SAS, COBOL, CICS, JCL, SMS, VSAM, etc.
- Referer: other forum
- Location: Dubuque, Iowa, USA
Re: Sample for Read from Systemlogger via ZLogstream
I see in the manual that getMaxBlockLength() is returning an int value -- what happens when you look at the int value?
Here's an article on using Zlogstream (page 15): http://publibz.boulder.ibm.com/epubs/pdf/e0z2n1a1.pdf
Here's an article on using Zlogstream (page 15): http://publibz.boulder.ibm.com/epubs/pdf/e0z2n1a1.pdf
Re: Sample for Read from Systemlogger via ZLogstream
Thanks for the link. Very interesting
But unfourtanely there is only described the write Method. The Browse Feature in this class is fairly new..
Anyway - I refactored my code and now I get an output - but I read only the same record. How could I read the logstream record by record? Not even Block by Block. The documentation is not really helpful....

Anyway - I refactored my code and now I get an output - but I read only the same record. How could I read the logstream record by record? Not even Block by Block. The documentation is not really helpful....
Code: Select all
public class mtbr01 {
public static void main(String[] args) throws IOException {
try{
//Log Stream name
String logName="MTLOGGER.TEST.MTPPS";
byte[] buffer=new byte[1000000];
//get Timestamp
long unixTimestamp = Instant.now().getEpochSecond();
int bytesRead =0;
//Open and connect to LogStream (MTLOGGER.TEST.MTPPS)
ZLogstream zlogger = new ZLogstream(logName);
zlogger.browseStartSearch(false,unixTimestamp);
for(int i=0;i<10;i++){
bytesRead=zlogger.readSearch(unixTimestamp, buffer, 0);
String value = new String(buffer);
System.out.println("Satz Nummer"+i);
System.out.println(value);
}
}
catch(ZLogstreamException EX)
{
//Print out messages and return codes from the logger
System.err.println("System logger error message <" +EX.getMessage() + ">");
System.err.println("System logger ReturnCode/ReasonCode <"+ EX.getReturnCode() +"/" + EX.getReasonCode() +">");
System.err.println("System logger resource <" + EX.getLogstreamName() + ">");
//Print out Java stack trace
EX.printStackTrace();
return;
}
}
}
-
- Similar Topics
- Replies
- Views
- Last post
-
- 2
- 2979
-
by willy jensen
View the latest post
Wed Jan 04, 2023 2:17 pm
-
- 0
- 2327
-
by VJSIRI
View the latest post
Fri Nov 13, 2020 1:53 am
-
- 6
- 2558
-
by sergeyken
View the latest post
Wed Nov 24, 2021 11:26 pm
-
- 6
- 6268
-
by Mainframe_Dev
View the latest post
Mon Jan 30, 2023 1:06 am
-
- 3
- 7908
-
by socker_dad
View the latest post
Thu Jan 28, 2021 4:13 am