Is there a way to specifiy the JOB name when creating a spooled file? So that my created s.f. doesn't have the default "QPRTJOB".
My method that creates a spooled file with the default QPRTJOB job:
public static SpooledFile createSpoolFile( com.ibm.as400.access.AS400 as, PrinterFile pPrinterFile,
OutputQueue outq, String msg ) {
SpooledFile result = null;
try {
PrintParameterList parms = new PrintParameterList();
// create a PrintParameterList with the values that we want
// to override from the default printer file...we will override
// the output queue and the copies value.
parms.setParameter( PrintObject.ATTR_PRINTER_FILE, pPrinterFile.getPath() );
parms.setParameter( PrintObject.ATTR_JOBUSER, AS400.getUser().getUserProfileName() );
parms.setParameter( PrintObject.ATTR_JOBNAME, "NASAOBRJVA" );
parms.setParameter( PrintObject.ATTR_OUTPUT_QUEUE, outq.getPath() );
parms.setParameter( PrintObject.ATTR_CHAR_ID, "*SYSVAL" );
SpooledFileOutputStream spool = new SpooledFileOutputStream( as, parms, pPrinterFile,
outq );
SCS5256Writer scsWtr = new SCS5256Writer( spool, pPrinterFile.getSystem().getCcsid(), pPrinterFile.getSystem() );
String[] redovi = msg.split( "\n" );
for ( int i = 0; i < redovi.length; i++ ) {
if (redovi[i].equals( "" ) || redovi[i].equals( " " )) {
continue;
}
scsWtr.write( redovi[i].trim() );
if (i < redovi.length - 1) {
scsWtr.newLine();
}
}
scsWtr.close();
result = spool.getSpooledFile();
System.out.println("Spool is in Job: " + result.getJobNumber() + "/" + result.getJobUser() + "/" + result.getJobName());
}
catch ( Exception e ) {
LOG.error( e );
}
return result;
}