× 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.



So many times I have seen something written in non-java communities to /just do this java/, like it was expected anyone reading would just know what to do. Seems often those that know, act as though everyone either knows all about java or should not be asking. Being in a java community, it can be tough to know what to expect or even hope for. I feel your pain... so from one non-java programmer to another, I offer:

Doing everything on a green screen, follow exactly [do not try to choose an alternate file name, for example] the steps that are included after the modified source code included just below:

<code>

import java.io.*;
import com.ibm.as400.access.*;
class POIStest1
{
public static void main(String argv[])
{
// embed test in a public class
try
{
byte[] buf = new byte[2048];
int bytesRead;
AS400 sys = new AS400();
SpooledFile splf =
new SpooledFile( sys // AS400
, "QPJOBLOG" // splf name
, 1 // splf number
, "MYJOB" // job name
, "MYUSER" // job user
, "123456" // job number
);
// open the spooled file for reading
// and get the input stream to read from
InputStream in = splf.getInputStream(null);
do
{ // read up to buf.length bytes of raw spool data into
// our buffer. The actual bytes read will be returned.
// The data will be a binary printer data stream that
// is the contents of the spooled file.
bytesRead = in.read( buf );
if( bytesRead != -1 )
{ // process the spooled file data.
System.out.println( "Read " + bytesRead + " bytes" );
}
} while( bytesRead != -1 );
in.close();
}
catch( Exception e )
{ System.out.println(e); // exception
}
}
}

</code>

rmvlnk '/tmp/POIStest1.*'
qsh cmd(' touch -C 1252 /tmp/POIStest1.java ')
edtf 'POIStest1.java'
;; Paste the above text into the file, and edit for job information
;; I did not use the passed string, to set values for SpooledFile
qsh
cd /tmp
;; issue the javac to create the class; wait for the $ prompt
;; afterwards there should be a /tmp/POIStest1.class
javac -g -verbose -encoding 437
-classpath /qibm/proddata/java400/jt400ntv.jar
/tmp/POIStest1.java
;; issue the java to run the test of the class
java -cp /qibm/proddata/java400/jt400ntv.jar:/tmp
POIStest1 'junk data; could be splf details'
;; example of output follows:
Read 2048 bytes
Read 2048 bytes
Read 215 bytes

Regards, Chuck

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.