Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

I need to find out the status (rdy, snd, hld, etc.) of a spool file from an as400 CL program

Posted on 2006-04-14
5
Medium Priority
?
543 Views
Last Modified: 2012-06-27
I need to find out when the status of the spool file created by this job has been printed and is in the SAV status. I'm not able continue in my program until the file has been printed. Any ideas? I'm using a DLYJOB now but I would like to continue right away once its at the SAV status.

Thanks.
0
Comment
Question by:billymcqueary
  • 2
  • 2
5 Comments
 
LVL 27

Expert Comment

by:tliotta
ID: 16456086
billymcqueary:

The Retrieve Spooled File Attributes (QUSRSPLA) API can return the status of a spooled file. When the Status is '*SAVED', you know you can continue.

Let me know if a sample of CL for this is needed.

Tom

0
 

Author Comment

by:billymcqueary
ID: 16456909
An example would be great if not too much to ask. Thanks.
0
 
LVL 13

Accepted Solution

by:
_b_h earned 2000 total points
ID: 16457249
Here is some sample code to get you started. It retrieves more than the status, so you can see how some of the other parms work. If you would like a pruned version, let me know.

PGM ( +                                                                      
    &SPLFNAME  /* SPOOLED FILE NAME                      INPUT      */  +    
    )                                                                        
/* PARMS FOR API */                                                          
DCL &RCVR     *CHAR    1500   /*RECEIVER VARIABLE                   */        
DCL &RCVRLEN  *CHAR       4   /*LENGTH OF RECEIVER VARIABLE         */        
DCL &RCVRFMT  *CHAR      10   /*FORMAT NAME                         */        
DCL &QUALJOB  *CHAR      26   /*QUALIFIED JOB NAME                  */        
DCL &INTJOB   *CHAR      16   /*INTERNAL JOB IDENTIFIER             */        
DCL &INTSPLF  *CHAR      16   /*INTERNAL SPOOLED FILE IDENTIFIER    */        
DCL &SPLFNAME *CHAR      10   /*SPOOLED FILE NAME                   */        
DCL &SPLNBR   *CHAR       4   /*SPOOLED FILE NUMBER                 */        
/* VALUES RETURNED BY API  */                                                
DCL &STATUS   *CHAR      10   /* STATUS                             */        
DCL &FORMTYPE *CHAR      10   /* FORM TYPE                          */        
DCL &USERDATA *CHAR      10   /* USER DATA                          */        
DCL &HOLD     *CHAR      10   /* HOLD BEFORE WRITING                */        
DCL &SAVE     *CHAR      10   /* SAVE AFTER WRITING                 */        
DCL &COPIESB  *CHAR       4   /* COPIES - BINARY                    */        
DCL &COPIESC  *CHAR       4   /* COPIES - CHARACTER                 */              
DCL &COPIESN  *DEC     (4 0)  /* COPIES - NUMERIC                   */              
DCL &PAGESB   *CHAR       4   /* PAGES  - BINARY                    */              
DCL &PAGESC   *CHAR       4   /* PAGES  - CHARACTER                 */              
DCL &PAGESN   *DEC     (4 0)  /* PAGES  - NUMERIC                   */              
DCL &LPIB     *CHAR       4   /* LINES PER INCH - BINARY - IN TENTHS*/              
DCL &LPIC     *CHAR       4   /* LINES PER INCH - CHARACTER         */              
DCL &LPIN     *DEC     (4 1)  /* LINES PER INCH - NUMERIC           */              
DCL &CPIB     *CHAR       4   /* CHARACTERS PER INCH - BINARY- IN TENTHS*/          
DCL &CPIC     *CHAR       4   /* CHARS PER INCH - CHARACTER             */          
DCL &CPIN     *DEC     (4 1)  /* CHARS PER INCH - NUMERIC               */          
DCL &OUTPTY   *CHAR       2   /* OUTPUT PRIORITY                        */          
             CHGVAR  &RCVRLEN    X'05DC'                                            
             CHGVAR  &RCVRFMT   'SPLA0100'                                          
             CHGVAR  &QUALJOB   '*                         '                        
             CHGVAR  &INTJOB    '                '                                  
             CHGVAR  &INTSPLF   '                '                                  
             CHGVAR  &SPLNBR    X'FFFFFFFF'                                        
             CALL    QUSRSPLA   (&RCVR  &RCVRLEN &RCVRFMT +                        
                                 &QUALJOB &INTJOB &INTSPLF +                        
                                &SPLFNAME &SPLNBR)                
            CHGVAR  &FORMTYPE  %SST(&RCVR   81  10)                
            SNDPGMMSG ('FORMTYPE >' || &FORMTYPE || '<')          
            CHGVAR  &USERDATA  %SST(&RCVR   91  10)                
            SNDPGMMSG ('USERDATA >' || &USERDATA || '<')          
            CHGVAR  &STATUS    %SST(&RCVR  101  10)                
            SNDPGMMSG ('STATUS >' || &STATUS   || '<')            
            CHGVAR  &HOLD      %SST(&RCVR  121  10)                
            SNDPGMMSG ('HOLD >' || &HOLD || '<')                  
            CHGVAR  &SAVE      %SST(&RCVR  131  10)                
            SNDPGMMSG ('SAVE >' || &SAVE || '<')                  
            CHGVAR  &COPIESB   %SST(&RCVR  165   4)                
            CHGVAR  &COPIESC   %BINARY(&COPIESB)                  
            CHGVAR  &COPIESN   &COPIESC                            
            SNDPGMMSG ('COPY >' || &COPIESC || '<')                
            CHGVAR  &PAGESB   %SST(&RCVR  141   4)                
            CHGVAR  &PAGESC   %BINARY(&PAGESB)                    
            CHGVAR  &PAGESN   &PAGESC                              
            SNDPGMMSG ('PAGES >' || &PAGESC || '<')                
            CHGVAR  &LPIB      %SST(&RCVR  173   4)                
             CHGVAR  &LPIC      %BINARY(&LPIB)        
             CHGVAR  &LPIN      &LPIC                  
             SNDPGMMSG ('LPI >' || &LPIC || '<')      
             CHGVAR  &CPIB      %SST(&RCVR  177   4)  
             CHGVAR  &CPIC      %BINARY(&CPIB)        
             CHGVAR  &CPIN      &CPIC                  
             SNDPGMMSG ('CPI >' || &CPIC || '<')      
             CHGVAR  &OUTPTY    %SST(&RCVR  181   2)  
             SNDPGMMSG ('OUTPTY >' || &OUTPTY || '<')  
ENDPGM                                                

Please post back any questions!
Barry
0
 
LVL 27

Expert Comment

by:tliotta
ID: 16457528
Barry's example grabs a number of returned attributes for a spooled file and sends the values out as messages. The &STATUS variable is the one of most interest here; others that are extracted from the return variable can be eliminated. (But they're useful examples for cloned functions.)

The actual resulting function is pretty small.

Tom
0
 
LVL 13

Expert Comment

by:_b_h
ID: 16457623
The pruned version looks more like:
PGM ( +                                                                              
    &SPLFNAME  /* SPOOLED FILE NAME                      INPUT      */  +            
    )                                                                                
/* PARMS FOR API */                                                                  
DCL &RCVR     *CHAR    1500   /*RECEIVER VARIABLE                   */              
DCL &RCVRLEN  *CHAR       4   /*LENGTH OF RECEIVER VARIABLE         */              
DCL &RCVRFMT  *CHAR      10   /*FORMAT NAME                         */              
DCL &QUALJOB  *CHAR      26   /*QUALIFIED JOB NAME                  */              
DCL &INTJOB   *CHAR      16   /*INTERNAL JOB IDENTIFIER             */              
DCL &INTSPLF  *CHAR      16   /*INTERNAL SPOOLED FILE IDENTIFIER    */              
DCL &SPLFNAME *CHAR      10   /*SPOOLED FILE NAME                   */              
DCL &SPLNBR   *CHAR       4   /*SPOOLED FILE NUMBER                 */              
/* VALUES RETURNED BY API  */                                                        
DCL &STATUS   *CHAR      10   /* STATUS                             */              
             CHGVAR  &RCVRLEN    X'05DC'                                            
             CHGVAR  &RCVRFMT   'SPLA0100'                                          
             CHGVAR  &QUALJOB   '*                         '                        
             CHGVAR  &INTJOB    '                '                                  
             CHGVAR  &INTSPLF   '                '                                  
             CHGVAR  &SPLNBR    X'FFFFFFFF'                          
             CALL    QUSRSPLA   (&RCVR  &RCVRLEN &RCVRFMT +          
                                 &QUALJOB &INTJOB &INTSPLF +          
                                 &SPLFNAME &SPLNBR)                  
             CHGVAR  &STATUS    %SST(&RCVR  101  10)                  
             SNDPGMMSG ('STATUS >' || &STATUS   || '<')              
            ENDPGM                                                                

The possible values for &STATUS are:
*CLOSED The program completely processed the file, but SCHEDULE(*JOBEND) was specified, and the job that produced the file has not yet finished.
*DEFERRED The spooled file has been deferred from printing.
*SENDING The spooled file is being sent or has been sent to a remote system.
*HELD The file is held.
*MESSAGE The file has a message requiring a reply or an action.
*OPEN The file was not completely processed and is not ready for a writer.
*PENDING The file is pending to be printed.
*PRINTER The complete file was sent to the printer, but a print complete status was not sent back.
*READY The file is available to be written.
*SAVED The file was written and is saved. This file remains saved until it is released.
*WRITING The writer is writing the file on a diskette or a printer device.

To find more info on QUSRSPLA, search for QUSRSPLA (or use the API finder) at the IBM infocenter:
http://publib.boulder.ibm.com/infocenter/iseries/v5r3/index.jsp

Barry
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Use this step by step method when setting up QuickBooks Online. They will allow you to explore the various features of the advanced settings available to you.
How does storytelling impact the web? What goes into a great story on the web? And how can it be used for marketing purposes? All of these questions will be answered.
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question