java - JT400 - Get spool file generated by a command -


i developing java class jt400 , trying result of command “dspmsg qsysopr" with:

as400 as400 = new as400(system, user, password); commandcall cmd = new commandcall(as400); cmd.runcommand("dspmsg qsysopr"); 

i found out command runs in job user quser, spool file result generated under user "user" specified when instantiate object as400.

i can run command, instead of messages in queue have result:

"printer output created."

i result code:

job job = cmd.getserverjob(); as400message[] messagelist = cmd.getmessagelist(); (int = 0; < messagelist.length; i++) {     system.out.println(messagelist[i].gettext());  } 

question 1: there way not receive messages in spool file have returned me na as400message or similar?

not been able so, using following method spool file:

 public string getspoolfile  (          string splfname,     // splf name          string splfnumbert,        // splf number          string jobname,      // job name          string jobuser,      // job user          string jobfnumber // job number          ) throws exception  {     int splno = integer.parseint(splfnumbert);     spooledfile sf = new spooledfile( as400,        // system                              splfname,     // splf name                              splno,        // splf number                              jobname,      // job name                              jobuser,      // job user                              jobfnumber               );         printparameterlist printparms = new printparameterlist();    printparms.setparameter(printobject.attr_workstation_cust_object, "/qsys.lib/qwpdefault.wscst");    printparms.setparameter(printobject.attr_mfgtype, "*wscst");     // create page input stream spooled file    printobjectpageinputstream is;    string data ="";    string response ="";      = sf.getpageinputstream(printparms);        bufferedreader d = new bufferedreader(new inputstreamreader(is));        while((data = d.readline() )!=null)        {            response+=data+"\n";        }      return response;   } 

the problem is: don't have parameters call method "getspoolfile". if manually log in as400, check spool file details , call method manually obtained parameters, spool file. job object receive under:

job job = cmd.getserverjob(); 

after running:

cmd.runcommand("dspmsg qsysopr"); 

is not same job created spool file. example, if check:

system.out.println(job.getuser()); 

i have "quser" result, spool file generated under “user” output queue.

question 2: how can job related generation of spool file?

question 3: can parameters related spool file generated spool file number , spool file name?

i need following information in order call "getspoolfile" method:

  • spool file name
  • spool file number
  • job name
  • job user
  • job number

thanks, carlos

you don't want "print" messages @ all. haven't said want messages once them (and getting qsysopr messages not idea in first place).

you might review as/400 message queue filtering - jt400 , begin thinking how want proceed. there lot can done messages.


Comments