AS/400 printer file keywords

470 pts.
Tags:
AS/400 commands
AS/400 Printer File
AS/400 printers
can you explain the difference between spacea,spaceb,skipa and skipb. I'm new to learning about as400 and printer files. can any one give me an example using source code showing the difference that occurs between using these 4 keywords

Software/Hardware used:
v5r3
ASKED: January 3, 2011  5:05 PM
UPDATED: January 5, 2011  8:05 AM

Answer Wiki

Thanks. We'll let you know when a new response is added.

These keywords control when spacing and/or skipping is done.
Usually before a Heading line is printed, you skip to a new page. Then you would use SKIPB.
If you want to skip to somewhere AFTER a line is printed, like after level break totals are printed, you would use SKIPA.
The SPACEA and SPACEB are the same. Do you want to do a SPACE before or after you print a line.

Discuss This Question: 6  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Kaly
    can you explain the difference between spacea,spaceb,skipa and skipb.
    I'm new to learning about as400 and printer files.
    can any one give me an example using source code showing the difference that occurs between using these 4 keywords.
    A-Physical file PF004 source
                                          UNIQUE
    R  RR
         STUNAM  10
         ROLLNU     5 0
         MARKS       3 0
         SEX             6
    K   ROLLNU
    4 records present in PF004 are
    STUNAM             ROLLNU         MARKS            SEX
    KAVYA                12,344             55                     FEMALE
    MADHAVAN        14,579            60                      MALE
    RAMYA                14,785            70                     FEMALE
    KRISHNAN          14,988            72                     MALE
    B-Printer File PRINT1 source 
        A          R HEADER                                      
        A                                       10  3'STUNAM'          
        A                                       10 20'ROLLNU'          
        A                                       10 30'MARKS'           
        A                                       10 40'SEX'             
        A           R DETAIL                                      
        A                                      SPACEB(1)         
        A               STUNAM        10            3                  
        A               ROLLNU           5  0     20                  
        A               MARKS             3  0     30                  
        A               SEX                   6        40                  
        A          R FOOTER                                      
        A                                      SPACEB(1)         
        A                                    20'END OF REPORT'   
    
    
     C-RPG/400 Program PRTTPG source
      FPF004       I   F  E                    DISK                 
      FPRINT1     O     E                    PRINTER              
      C                         WRITE    HEADER                      
      C                         READ      PF004                    60 
      C           *IN60     DOWEQ  *OFF                        
      C                         WRITE    DETAIL                      
      C                         READ      PF004                    60 
      C                         ENDDO                            
      C                         WRITE     FOOTER                      
      C                         SETON                         LR
    
    D-spooled file result set
    
                                                            Display Spooled File                                                        
     File  . . . . . :   PRINT1                                                                               Page/Line   1/10          
     Control . . . . .                                                                                        Columns     1 - 130       
     Find  . . . . . .                                                                                                                  
     *...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9....+....0....+....1....+....2....+....3 
       STUNAM              ROLLNU         MARKS        SEX                                                                                         
       KAVYA                 12344             055               FEMALE                                                                                      
       MADHAVAN        14579              060               MALE                                                                                        
       RAMYA                14785              070               FEMALE                                                                                      
       KRISHNAN          14988              072               MALE                                                                                        
                        END OF REPORT                                                 
    Bottom 
     F3=Exit   F12=Cancel   F19=Left   F20=Right   F24=More keys                                   
    
    I have changed from SPACEB to SPACEA now in my printer file source
    E-Changed PRINT1 Source
    A          R HEADER                                      
        A                                       10  3'STUNAM'          
        A                                       10 20'ROLLNU'          
        A                                       10 30'MARKS'           
        A                                       10 40'SEX'             
        A           R DETAIL                                      
        A                                      SPACEA(1)         
        A               STUNAM        10            3                  
        A               ROLLNU           5  0     20                  
        A               MARKS             3  0     30                  
        A               SEX                   6        40                  
        A          R FOOTER                                      
        A                                      SPACEA(1)         
        A                                    20'END OF REPORT'   
    
    F-Spooled file Result Set after keyword change
                                                            Display Spooled File                                                        
     File  . . . . . :   PRINT1                                                                               Page/Line   1/10          
     Control . . . . .                                                                                        Columns     1 - 130       
     Find  . . . . . .                                                                                                                  
     *...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9....+....0....+....1....+....2....+....3 
       KAVYAM              12344U    055KS     FEMALE                                                                                      
       MADHAVAN         14579      060          MALE                                                                                        
       RAMYA                 14785      070          FEMALE                                                                                      
       KRISHNAN           14988      072          MALE                                                                                        
                        END OF REPORT                                                            
                                                                                                                                        
                                                                                                                                 Bottom 
     F3=Exit   F12=Cancel   F19=Left   F20=Right   F24=More keys                                                                        
     Overprinting not displayed.
    470 pointsBadges:
    report
  • philpl1jb
    DSPSPLF will not display the spacing and overstrikes - you need to print it. Either SPACEA on every record or SPACEB on every record A R HEADER skipb(2) <-- starts header on the second line of a new page each time it's called spacea(2) <-- advances to the next line and skips a line after the header prints A 10 3′STUNAM’ A 10 20′ROLLNU’ A 10 30′MARKS’ A 10 40′SEX’ A R DETAIL A SPACEA(1) <-- ok after detail prints it will advance to the next line for the next print A STUNAM 10 3 A ROLLNU 5 0 20 A MARKS 3 0 30 A SEX 6 40 A R FOOTER A SPACEA(1) <-- after the footer prints it will advance to the next line but you will never see this blank line perhaps you want a SPACEB(1) which, since it alreayd advanced to a new line will put a blank line before the 'END OF REPORT' A 20′END OF REPORT’ Phil
    48,575 pointsBadges:
    report
  • TomLiotta
    DSPSPLF will not display the spacing and overstrikes... Although that's certainly true, you can detect spacings by watching the {Page/Line} values at the upper right of the display and moving through the spooled file a line at a time. The {Line} value will increment to show that blank lines will be printed. Blank lines usually don't physically exist in spooled files. Tom
    125,585 pointsBadges:
    report
  • TomLiotta
    In Windows Word, you can select a paragraph, then right-click on it and select 'Paragraph...' from the context menu. The options that are shown include the "space before", "space after" and "skip" functions among others. The SPACEA/SPACEB and SKIPA/SKIPB elements of a printer file are the same. But commonly on AS/400 types of systems, the functions are seen on printer files that are intended to print through line-oriented definitions. Usually, a single font is used throughout the entire report. Word-processing programs such as Word have need for finer controls for tables of content, outlines, topic and sub-topic headings and all kinds of other features that seldom have the same frequency of use in standard business reports. (It's all available, just seldom needed.) Tom
    125,585 pointsBadges:
    report
  • philpl1jb
    Tom is right, as usual The page & line counts on dspsplf help to make sense of your project, but you cannot tell when a line is printed over another line .. as in your second example. Phil
    48,575 pointsBadges:
    report
  • TomLiotta
    Thanks to Kaly for providing sample code we can all look at. I've taken it and made small changes to see if we can emphasize the keywords. The physical file stayed the same. The RPG is essentially the same, just some details changed:
         FPF004     IF   E             DISK
         FPRINT1    O    E             PRINTER OFLIND(*IN01)
    
         C                   WRITE(E)  HEADER
         C                   READ      PF004                                  60
    
         C     *IN60         DOWEQ     *OFF
         C                   WRITE     DETAIL
         C                   READ      PF004                                  60
         C                   ENDDO
    
         C                   WRITE     FOOTER
         C                   SETON                                        LR
    The printer file is changed to add an extra element to show how spacing can be placed inside a record format. A single record format can handle almost any number of lines:
        A           R HEADER
        A                                       SKIPB(6)
        A                                      3'MY SAMPLE REPORT'
        A                                       SPACEA(2)
        A                                      3'STUDENT'
        A                                     20'ROLL'
        A                                       SPACEA(1)
        A                                      3'NAME'
        A                                     20'NUMBER'
        A                                     30'MARKS'
        A                                     40'SEX'
        A                                     50'COLUMN HEADINGS'
        A                                       SPACEA(2)
        A           R DETAIL
        A                                       SPACEA(1)
        A             STUNAM        10         3
        A             ROLLNU         5  0     20
        A             MARKS          3  0     30
        A             SEX            6        40
        A           R FOOTER
        A                                       SPACEA(1)
        A                                     20'END OF REPORT'
    That lets the heading become a little more complex, resulting in this output:
      MY SAMPLE REPORT
    
      STUDENT          ROLL
      NAME             NUMBER    MARKS     SEX       COLUMN HEADINGS
    
      KAVYA            12344     055       FEMALE
      MADHAVAN         14579     060       MALE
      RAMYA            14785     070       FEMALE
      KRISHNAN         14988     072       MALE
                       END OF REPORT
    The spacing causes the HEADER format to print over five lines, leaving two blank lines. The RPG still uses just a single WRITE op-code to print all of the HEADER lines at once. A minor change to comment out one line makes the print file look this way:
        A           R HEADER
        A                                       SKIPB(6)
        A                                      3'MY SAMPLE REPORT'
        A                                       SPACEA(2)
        A                                      3'STUDENT'
        A                                     20'ROLL'
        A                                       SPACEA(1)
        A                                      3'NAME'
        A                                     20'NUMBER'
        A                                     30'MARKS'
        A                                     40'SEX'
        A                                     50'COLUMN HEADINGS'
        A************                           SPACEA(2)
        A           R DETAIL
        A                                       SPACEA(1)
        A             STUNAM        10         3
        A             ROLLNU         5  0     20
        A             MARKS          3  0     30
        A             SEX            6        40
        A           R FOOTER
        A                                       SPACEA(1)
        A                                     20'END OF REPORT'
    With that one SPACEA(2) commented out, the first detail line will overlay the last printed header line:
      MY SAMPLE REPORT
    
      STUDENT          ROLL
      KAVYA            12344R    055KS     FEMALE    COLUMN HEADINGS
      MADHAVAN         14579     060       MALE
      RAMYA            14785     070       FEMALE
      KRISHNAN         14988     072       MALE
                       END OF REPORT
    The SPACEA(2) could have been inactivated by a conditioning indicator. Enabling and disabling spacing with boolean indicators can help you combine formats in sequence in different ways. The SKIPA()/SKIPB() keyword lets you position to specific lines on a page without needing to space through the lines in between. That can be handy when you have a fixed form. An invoice might always have a comment that you print on line 55, near the bottom of the form. It doesn't matter if there is a single detail item or 30 items. You can always SKIPB(55) to skip to line 55 to print the comment. Tom
    125,585 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following