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



What is it you're trying to accomplish?  You might be almost there.  In your
original post it sounds like you want to access the spoolfiles of the child
job.  Unless you need additional info about the child job, skip the QUSRJOBI
and go straight to QUSLSPL.  QUSLSPL will return a list of spoolfiles for
the qualified jobname that you retrieved with Qp0wGetJobID and it will place
that list into a user space. 

Maybe something like this helps?

 #include <errno.h>
 #include <spawn.h>
 #include <qp0wpid.h>


    char     path[] = "/QSYS.LIB/MYLIB.LIB/CHILD.PGM";
    int      fd_count; 
    int      fd_map;
    struct   inheritance  inherit;
    char     *argv;
    char     *envp;

    struct   QP0W_Job_ID_T  jobinfo;

    char     format[8] = "SPLF0200";                  
    char     usr_prf[10] = "*CURRENT  ";
    char     outq[20] = "*ALL                ";
    char     formtyp[10] = "*ALL      ";
    char     usrdta[10] = "*ALL      ";
    char     jobnam[26] = "                          ";



  child_pid = spawn(path, 
                     fd_count, 
                     fd_map,
                     &inherit, 
                     argv,
                     envp);

   int Qp0wGetJobID(child_pid, *jobinfo); 

   jobnam = jobinfo

   QUSLSPL(spc_name,        /* User space name and lib */    
           format,          /* API format              */    
           usr_prf,         /* User profile            */    
           outq,            /* Output Queue            */    
           formtyp,         /* Form type               */    
           usrdta,          /* User data               */    
           error_code,      /* Error code structure    */    
           jobnam,          /* Job name                */    
           keys,            /* Keys to return          */    
           number_of_keys); /* Number of keys          */


You will need to create a user space for QUSLSPL to load the list to.  The
System API Programming book as an example C pgm that illustrates QUSLSPL.  

I realize this is kind of bare bones but I'm not really a C pgmr!  RPG I
could help you some, given time.  Maybe some one more versed in C can chime
in, but hopefully this points you in the right direction.  

Have a good weekend!


Tom D.

 |  -----Original Message-----
 |  From: Walt Fles [mailto:wfles@xxxxxxxxxxx]
 |  Sent: Friday, June 04, 2004 15:13
 |  To: Midrange Systems Technical Discussion
 |  Subject: Re: C access to a job's spooled files
 |  
 |  
 |  Ok I found the API call and have NO idea how to use it.  The 
 |  documentation and the header file seem to conflict.
 |  
 |  I call it as follows:
 |  QUSRJOBI(  &(JOBI300 type structure ), sizeof(JOBI0300), 
 |  "JOBI0300", 
 |  "<some job name>", "16 spaces" );
 |  
 |  I assertained the "some job name" and the "16 spaces" from 
 |  what I did 
 |  find out this API call from inside some
 |  RPG code.
 |  
 |  This does not work at all, and I get a "Job name specified 
 |  not  valid" 
 |  before I get a CPF code ( Im assuming something
 |  like a core dump in UNIX ).
 |  
 |  I was assuming that I would put into the last 2 parameters 
 |  for this API 
 |  ( Qualified job name and Internal Job Identifier ) that
 |  values returned from  Qp0wGetJobID( pid, job_id_structure 
 |  ), but I guess 
 |  that is not the case.
 |  
 |  Any idea how to fill in the paramters for QUSRJOBI, and 
 |  maybe a snipet 
 |  of C code of how to go to a pid returned by
 |  spawn(), to getting a launched job's information?
 |  
 |  TIA!
 |  
 |  Walt Fles
 |  
 |  
 |  

This communication is confidential, intended only for the named recipient(s)
above and for the purposes stated herein. It may contain trade secrets or
other information that is exempt from disclosure under applicable law.
Except as otherwise authorized in writing, any use, dissemination,
distribution, or copying of this communication by or to anyone other than
the named recipient(s) or for any purpose other than the purpose as stated
or intended herein is strictly prohibited. If you have received this
communication in error, please immediately notify SDD by calling us at (561)
276-7004. 



As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.