Now, Get RPG Codes in all three formats only on this website on every RPGLE related programming article.

Fixed, /Free and Fully Free RPG


Introduction to Printer File in IBM i (AS400)

Introduction to Printer File in IBM i (AS400)
Introduction to Printer File in IBM i (AS400), printer file, printer files, prtf, printer file in as400, printer file in ibmi, prtf in ibmi, prtf in as400, what is printer file, what is prtf, program described prtf, program described printer file, externally described printer file, external described prtf, advantage of external prtf over program described prtf
Introduction to Printer File in IBM i (AS400)

What is Printer File (PRTF) in IBM i

The Printer File is used as a medium to transfer the data from the program to the printer. CRTPRTF command can be used to create the printer file object. The attribute for the printer files object would be PRTF.

  • WRKOBJ PRTF3A
  •                                Work with Objects                              
                                                                                  
     Type options, press Enter.                                                   
       2=Edit authority        3=Copy   4=Delete   5=Display authority   7=Rename 
       8=Display description   13=Change description                              
                                                                                  
     Opt  Object      Type      Library     Attribute   Text                      
          PRTF3A      *FILE     EASYCLASS1  PRTF        SPACEA keyword in External
    

    Printer File parameters (SPOOL, DEV, OUTQ, SPLFOWN)

    There are many parameters in the CRTPTF command but some of them are explained below.

    SPOOL

    SPOOL parameter is used either to spool the printer file data. If it *YES the data is first spooled to a particular output queue then it gets printed and if *NO the data is directly going to the printer.

                       S        Create Printer File (CRTPRTF)               
                                                                          
     Type choices, press Enter.                                           
                                                                          
     Edge stitch:                     EDGESTITCH                          
       Reference edge . . . . . . . .                *NONE                
       Reference edge offset  . . . .                                     
       Number of staples  . . . . . .                                     
       Staple offsets . . . . . . . .                                     
                               + for more values                          
     Saddle stitch:                   SADLSTITCH                          
       Reference edge . . . . . . . .                *NONE                
       Number of staples  . . . . . .                                     
       Staple offsets . . . . . . . .                                     
                               + for more values                          
     Font resolution for formatting   FNTRSL         *DEVD                
     Defer write  . . . . . . . . . . DFRWRT         *YES                 
     Spool the data . . . . . . . . . SPOOL          *YES                 
     Spooled output queue . . . . . . OUTQ           *JOB                 
       Library  . . . . . . . . . . .                                     +                            
    

    DEVICE (DEV)

    It is used for printing printer files. It specifies the name of a printer device description. For *NO (non-spooled), this identifies the printer device used to produce the printed output.

                              Create Printer File (CRTPRTF)                         
                                                                                   
    Type choices, press Enter.                                                     
                                                                                   
    File . . . . . . . . . . . . . . FILE                                          
      Library  . . . . . . . . . . .                  *CURLIB                      
    Source file  . . . . . . . . . . SRCFILE        *NONE                          
      Library  . . . . . . . . . . .                                               
    Source member  . . . . . . . . . SRCMBR         *FILE                          
    Generation severity level  . . . GENLVL         20                             
    Flagging severity level  . . . . FLAG           0                              
    Device:                          DEV                                           
      Printer  . . . . . . . . . . .                *JOB                           
    Printer device type  . . . . . . DEVTYPE        *SCS                           
    Text 'description' . . . . . . . TEXT           *SRCMBRTXT                     
                                                                                   
    

    OUTQ

    For spooled output, the file is placed on the output queue determined by the OUTQ parameter.

                               Create Printer File (CRTPRTF)                     
                                                                                
     Type choices, press Enter.                                                 
                                                                                
     Edge stitch:                     EDGESTITCH                                
       Reference edge . . . . . . . .                *NONE                      
       Reference edge offset  . . . .                                           
       Number of staples  . . . . . .                                           
       Staple offsets . . . . . . . .                                           
                               + for more values                                
     Saddle stitch:                   SADLSTITCH                                
       Reference edge . . . . . . . .                *NONE                      
       Number of staples  . . . . . .                                           
       Staple offsets . . . . . . . .                                           
                               + for more values                                
     Font resolution for formatting   FNTRSL         *DEVD                      
     Defer write  . . . . . . . . . . DFRWRT         *YES                       
     Spool the data . . . . . . . . . SPOOL          *YES                       
     Spooled output queue . . . . . . OUTQ          *JOB                       
       Library  . . . . . . . . . . .                                           
    

    Spool File Owner (SPLFOWN)

    The spooled file is owned by the current effective user profile of the job.

                               Create Printer File (CRTPRTF)                       
                                                                                  
     Type choices, press Enter.                                                   
                                                                                  
     Form type  . . . . . . . . . . . FORMTYPE       *STD                         
     Copies . . . . . . . . . . . . . COPIES         1                            
     Expiration date for file . . . . EXPDATE        *NONE                        
     Days until file expires  . . . . DAYS                                        
     Page range to print:             PAGERANGE                                   
       Starting page  . . . . . . . .                1                            
       Ending page  . . . . . . . . .                *END                         
     Max spooled output records . . . MAXRCDS        100000                       
     File separators  . . . . . . . . FILESEP        0                            
     Spooled output schedule  . . . . SCHEDULE       *FILEEND                     
     Hold spooled file  . . . . . . . HOLD           *NO                          
     Save spooled file  . . . . . . . SAVE           *NO                          
     Output priority (on OUTQ)  . . . OUTPTY         *JOB                         
     User data  . . . . . . . . . . . USRDTA         *SOURCE                      
     Spool file owner . . . . . . . . SPLFOWN        *CURUSRPRF                   
    

    Types of Printer Files

    There are two types of Printer Files available in IBM i:

  • Program described printer file.
  • Externally described printer file.
  • Program described printer file

    A printer file (records and fields) defined within an HLL application program is called a program described printer file. This can be used only within the program and the source would be written in O-SPECS of the RPG program.

    Externally described printer file

    Externally described printer file (records and fields) defined in external DDS. It can be used within a different RPG program.

    IBM Supplied printer files in IBM i

  • QSYSPRT: A Program described printer files in library QSYS.
  • QPRINT: Default spooled output printer file for normal print.
  • QPRINTS: Default spooled output printer file for special forms.
  • QPRINT2: Default spooled output printer file for two copies of the output
  • QPSPLPRT: Default spooled output printer file for the spooling subsystem.
  • The default printer file for the system is QSYSPRT.

    Advantage of Externally described printer file over program described printer file

    Externally described printer file (records and fields) defined in external DDS. It can be used multiple RPG programs whereas Program described printer file can be used only within the program and the source would be written in O-SPECS of the RPG program.

    Important points related to the Printer file

    The maximum number of record formats and fields is 1024.

    The maximum number of fields in any one record format is 32767.

    The maximum combined length of all named fields and indicators in a record format is 32767 bytes

    Post a Comment

    © AS400 and SQL Tricks. All rights reserved. Developed by Jago Desain