170 pts.
 Outfile for WRKJOB command.
HI All, I need to print all the instance of a job in some spool file or database file. Suppose we have a daily job ABCJOB. Now if I do WRKJOB ABCJOB, it will display all the jobs with date and if I select any, it will show the spool file and other options. Now what I want is instead of displaying all the jobs in screen, it should dump it in spool file or some database file. Thanks, Deepak

Software/Hardware used:
AS/400
ASKED: January 31, 2013  9:30 PM
UPDATED: February 1, 2013  1:14 PM
  Help
 Approved Answer - Chosen by ddaswani (Question Asker)

DSPLOG QHST for a date range, specify output *print, press F10 for more parameters and enter ABCJOB  for jobs to display.All ABCJOBs during that date range will be listed.

ANSWERED:  Jan 31, 2013  9:42 PM (GMT)  by ddaswani

 
Other Answers:
Last Wiki Answer Submitted:  February 1, 2013  1:14 pm  by  Michael Tidmarsh   11,400 pts.
Latest Answer Wiki Contributors:  Michael Tidmarsh   11,400 pts.
To see other answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

Thanks LtitBe.It should work.

 170 pts.

 

…it should dump it in sool fiile or some databse file.
 
What do you expect to find in any output file? How do you expect to process it? For most uses, neither WRKJOB nor DSPLOG will give you very much useful information. To process the output, a lot of messy programming will have to be done.
 
If you describe what you actually need to do with the file, much better methods can be suggested.
 
Tom

 108,135 pts.

 

Hi Tom,

We are using Robot for scheduling and other stuff, but now instead of Robot, We are using ESP which is on mainframes…so ESP kick off the job…

Now the main problem is like Robot keep all the Spool file under the Job with all the history..ESP saves the history for 1 day…

Now what i m trying to do..is built a similar sort of utility..which have the list of all the jobs run on which date and through that we can get directly the spool file of the any job run previously…

I hope u got my point.

 170 pts.

 

If you want the spoolfile contents of all the times the job was run yo may be able to do it this way. If all the output was directed to 1 OUTQ you could dump the contents to a spool file. Copy that to a PF. Read that pf for the spool file info and copy that to another flat file with an add option for each spoolfile. Something like this…

             PGM                                                          
                                                                  
             DCL        VAR(&SPOOL)  TYPE(*CHAR) LEN(6)           
             DCL        VAR(&JOBNR)  TYPE(*CHAR) LEN(6)           
             DCL        VAR(&CLWORK) TYPE(*CHAR) LEN(132)         
             DCL        VAR(&USRNM)  TYPE(*CHAR) LEN(10)          
             DCL        VAR(&JOBNM)  TYPE(*CHAR) LEN(10)          
                                                                  
             DCLF       FILE(WORK)                                
                                                                  
             WRKOUTQ    OUTQ(FRNPRT) OUTPUT(*PRINT)               
             CPYSPLF    FILE(QPRTSPLQ) TOFILE(WORK)               
             DLTSPLF    FILE(QPRTSPLQ)                            
                                                                  
/* Read spool entries                                          */ 
                                                                  
TAG01:       RCVF                                                 
             MONMSG     MSGID(CPF0000) EXEC(GOTO CMDLBL(TAGDONE))   
                                                                  
/* GET SPOOL FILE                                                   */          
                                                                                
             CHGVAR     VAR(&JOBNR) VALUE(%SST(&CLWORK 95 6))                   
             CHGVAR     VAR(&SPOOL) VALUE(%SST(&CLWORK 75 4))                   
             CHGVAR     VAR(&USRNM) VALUE(%SST(&CLWORK 13 10))                  
             CHGVAR     VAR(&JOBNM) VALUE(%SST(&CLWORK 84 10))                  
                                                                                
/*  Zero fill spool number                                       */             
             IF         COND(%SST(&SPOOL 1 1) *EQ ' ') THEN(CHGVAR +            
                          VAR(%SST(&SPOOL 1 1)) VALUE('0'))                     
             IF         COND(%SST(&SPOOL 2 1) *EQ ' ') THEN(CHGVAR +            
                          VAR(%SST(&SPOOL 2 1)) VALUE('0'))                     
             IF         COND(%SST(&SPOOL 3 1) *EQ ' ') THEN(CHGVAR +            
                          VAR(%SST(&SPOOL 3 1)) VALUE('0'))                     
                                                                                
/* COPY TO DATABASE                                                 */          
                                                                                
             CPYSPLF    FILE(QSYSPRT) TOFILE(MY_LIB/MY_DB) +                    
                          JOB(&JOBNR/&USRNM/&JOBNM) SPLNBR(&SPOOL) MBROPT(*ADD) 
             GOTO       CMDLBL(TAG01)                                           
                     
 TAGDONE:    ENDPGM 

  

 3,915 pts.

 

…which have the list of all the jobs run on which date and through that we can get directly the spool file of the any job run previously…
 
That helps a little, but it misses a big part.
 
You can simply run WRKJOB for that job name from a command line to get access to all the spooled files. Or iSeries Navigator will bring up a list of all jobs of that name that have spooled output, and you can work with spooled files from there. Why do you need a utility for it? What does the utility need to do that isn’t already available?
 
It’s fairly easy for me to create that kind of utility on my systems because I already have a lot of little procedures that I can bind together to do it. It will take more work for you unless you also have code to do the parts that go into it. To know the right parts, it needs knowing what the purpose is. What will the utility be used for? How will it be used? Who will use it?
 
Tom

 108,135 pts.