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



Java program writing to text and use RPG to print is my plan B.  Below is my 
print method to create spooled file on the
AS400 and writing to it in Java.  I'm following the example in the Toolbox with 
some alterations.  Basicall, I get the
string from from a vector variable "rptDetailLine" and convert that string to 
byte array to write to
SpooledFileOutputStream "out".  So, far my this method will create a spooled 
file, but I can not display, copy, or sent
it.  The is the error I got when I tried to display the spooled file.  From the 
error, looks like the file contain
ASCCII data for PC and not AS/400.  What do I need to do to fix this?

 Message ID . . . . . . :   CPF3429       Severity . . . . . . . :   30
 Message type . . . . . :   Diagnostic
 Date sent  . . . . . . :   11/28/01      Time sent  . . . . . . :   12:48:52

 Message . . . . :   File QPNPSPRTF number 9 cannot be displayed, copied, or
   sent.
 Cause . . . . . :   File QPNPSPRTF number 9 job 401691/PRAK_M/QPRTJOB cannot
   be displayed, copied, or sent.  Reason code is 3.  If the member option
   (MBROPT) parameter is specified as *REPLACE on the Copy Spooled File
   (CPYSPLF) command, the TOFILE was cleared.
     1 - The file has no records.
     2 - The file contains only blank records, graphics, bar codes, or
   intelligent printer data stream (IPDS) transparent data.
     3 - The file contains only ASCII data intended for a personal computer
   printer.
     4 - The file contains only advanced function printing data stream (AFPDS)



public void printSOVRFYReport(AS400 system, OutputQueue outputQueue)
    throws
        java.io.IOException,
        com.ibm.as400.access.AS400SecurityException,
        com.ibm.as400.access.AS400Exception,
        java.lang.InterruptedException,
        com.ibm.as400.access.ErrorCompletingRequestException {

    SpooledFile spooledFile = null;
    SpooledFileOutputStream out;
    PrintParameterList parms = new PrintParameterList();

//    parms.setParameter(PrintObject.ATTR_FORMTYPE, "*STD");
//    parms.setParameter(PrintObject.ATTR_COPIES, 1);
//    parms.setParameter(PrintObject.ATTR_SAVE, "*YES");
    parms.setParameter(PrintObject.ATTR_OUTPUT_QUEUE, outputQueue.getPath());
     parms.setParameter(PrintObject.ATTR_CHAR_ID, "*SYSVAL");
//   parms.setParameter(PrintObject.ATTR_DATAFORMAT, "*RCDDATA");

//    PrinterFile printerFile = new PrinterFile(system, 
"/QSYS.LIB/MARADY.LIB/TPSUPD.FILE");
    out = new SpooledFileOutputStream(system, parms, null, outputQueue);
     String line = "";
    for (int idx = 0; idx < rptDetailLine.size(); idx++) {
         line = ((String) rptDetailLine.elementAt(idx));
        out.write(line.getBytes());

    }
    out.close(); // close the spooled file
    spooledFile = out.getSpooledFile();  // get a reference to the new spooled 
file
}


Regards,
             Marady Prak
             Technical Support Specialist






                    "Joe Pluta"
                    <joepluta@PlutaBro       To:     <java400-l@midrange.com>
                    thers.com>               cc:
                    Sent by:                 Subject:     RE: Creating spooled 
file with AS/400 Toolbox
                    java400-l-admin@mi
                    drange.com


                    11/28/2001 12:12
                    PM
                    Please respond to
                    java400-l






Marady, I'm not sure what you're asking.  If you're asking if you can open a
printer file using a Java class and output data to it, thereby creating a
print file, then the answer is (probably) "no".  There are numerous ways
around this, though.  Among them:

1. Call a program.  In general, this is the way we create reports.  We call
an RPG program that generates a printed report.  This way gives you the most
control over the output.

2. Write to a text file, then dump the text file to print.

What is the business requirement here?

Joe


> -----Original Message-----
> From: MaradyPrak@BigLots.com
> Subject: Re: Creating spooled file with AS/400 Toolbox
>
> Any suggestions?

_______________________________________________
This is the Java Programming on and around the iSeries / AS400 (JAVA400-L) 
mailing list
To post a message email: JAVA400-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/java400-l
or email: JAVA400-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/java400-l.







As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.