Problem solve Get help with specific problems with your technologies, process and projects.

Determine the size of a spool file within an RPG program

I would like to break a spool file into pieces according to the media I'm going to save it to (CD, diskette, etc.). Is the any way to determine the size of the spool file within RPG program (infds)?

You can use the API QUSRSPLA. Located at offset 1472 or the return variable you will find the spooled file size. You will also need the size multiplier located at 1476 in order to get bytes, kilo, mega, ect.

It should look something like this:

 /copy qsysinc/qrpglesrc,QUSRSPLA                                      
D RtnVar                              Like(QUSA010001)                 
D RtnLen                        10I 0                                  
D APIFmt                         8A   Inz('SPLA0100')                                 
D JobFull                       26A   Inz('JOBNAME   USER      000001')
D IntId                         16A                                    
D IntSplID                      16A                                    
D SplfName                      10A   Inz('QSYSPRT')                   
D SplfNbr                       10I 0 Inz(-1)                          
D SizeBytes                     20I 0                                  
 * This is in the normal call format
C                   Eval      RtnLen = %Len(QUSA010001)
C                   Call      'QUSRSPLA'               
C                   Parm                    RtnVar     
C                   Parm                    RtnLen     
C                   Parm                    APIFmt     
C                   Parm                    JobFull    
C                   Parm                    IntId      
C                   Parm                    IntSplID   
C                   Parm                    SplfName  
C                   Parm                    SplfNbr   
C                   Movel     RtnVar        QUSA010001
C     QUSSFILS      Mult      QUSSSM02      SizeBytes 


The Best Web Links: tips, tutorials and more.

Ask your OS/400 questions--or help out your peers by answering them--in our live OS/400 discussion forums.

Dig Deeper on Installation

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Join the conversation

1 comment

Send me notifications when other members comment.

Please create a username to comment.