Friday, December 6, 2013

Day-14.

 Printer File Through O-Spec:

Overview:

This module enables the student to understand the concept of Printer File through O-Spec.

 Outline:
Topics covered,
·         RPG Logic Cycle
·         Output-specification
·         Printer file through O-spec
·         Level Break

 Objective:
By the end of this module, the student should be able to:
  • IPO
  • RPG logic Cycle
  • Level Break in printer files.
 RPG Logic Cycle:
 RPG/400 logic cycle is also known as program cycle, is a sequence of steps that your program performs for each record read.

 Following are the points to be remembered when using a logic cycle.

      1)    Files are opened automatically.
2)    Files are closed automatically
3)    There is a first cycle for the very first time and afterwards subsequent cycles.
4)    The IP indicator is active only for the first cycle. It is off after performing step 1 of logic cycle.
5)    There are 4 types of outputs.
(i)     Header – Header type output contains constant headings such as titles, column heading, page                   number and dates.
(ii)   Detail time output:- At detail time, the program calculates and writes data for one or more records. E.g. if a salesman brings four orders, and we print a record for each order, we are printing four detail records.
(iii)   Exception time output –Exception records are written during calculation time using EXCPT operation code.
(iv) Total time output-At total time, the program calculates and writes data for a group of related records e.g. if a salesman brings four orders and we print only one record that shows the total of four order, we are printing one total record.
      6)    During the first cycle, total time calculations and output are not performed.
7)    Those calculations that have a control level indictor (L1-L9) in position 7 and 8 of calculation specification are known as total time calculation and those calculations without control level indictor in position 7 and 8 of calculation Specifications are known as detail time calculation.
 In output specification, we are using D in position 15 to denote detail time output and T in position 19 to denote total time output.

Note: -

A program is processed by logic cycle only when it contains a primary file and optionally one or more secondary files. If no primary file is defined and one or more secondary files are defined inside the RPG/400 program, then the first secondary file will work as primary file.

First we will study different type of prompt used in the Printer Files:

1)    IPIX

2)    IPJX

3)    IPO

4)    IPP


IX Specification line is broken into following parts

Positions
Name
Entry
1-2
Page
Page number
3-5
Line
Line number
6
Form type
I
7-14
Record name
Record format name
15-18

Blank
19-20
Record Identifying indicators
Blank
01-99
L1-L9,LR
H1-H9
U1-U8
RT
21-74

Blank
75-80
Comments
Optional

Record name: Type the external name of the record format.

 Record Identifying indicators:  Type a value from 01 to 99 to represent a general indicator. 

IPJX:

 JX Specification line is broken into following parts

Positions
Name
Entry
7-20

Blank
21-30
External field name
Field name
31-52

Blank
53-58
RPG field name
Field name
59-60
Control level
Blank
L1-L9
61-62
Match fields
Blank
M1-M9
63-64

Blank
65-70
Field indictors
Blank
01-99
H1-H9
U1-U8
RT
71-74

Blank
75-80
Comments
Optional

RPG Field Name: Type the name of the field as defined in the external record description (if six characters or fewer), or the name that replaces the external field name defined in positions 21 through 30.  

Control level:  Type a value from L1 to L9 if this field is a control field.

IPO:
O Specification line is broken into following parts

Positions
Name
Entry
1-2
Page
Page number
3-5
Line
Line number
6
Form type
O
7-14
File name
Valid file name
14-16
AND/OR
AND or OR
15
Type
H or D
T
E
16-18
ADD/DEL
ADD
DEL
16
Fetch overflow
Release
Blank
F
R
17
Space before
0 or blank
1
2
3
18
Space after
0 or blank
1
2
3
19-20
Skip before
1-99
A0-A9
B0-B2
21-22
Skip after
1-99
A0-A9
B0-B2
23-31
Output indicators
Blank
1-99
KA-KN,KP-KY
L1-L9
H1-H9
U1-U8
OA-OG,OV
MR
LR
RT
1P
32-37
EXCPT name
Record group name
38-74

Blank
75-80

Optional

Filename: Type the name of the output file.

 Type:    Choose from the following        

1)   H or D                                                               

o   Type H if you want header records or D if you want detail records.

2)   T                                                                    

o   Type T if you want total records.

3)   E                                                                     

o   Type E if you want exception records.                            

  Space/ Before: Type 0 or leave the field blank if you want no spaces before the line is printed. Type the number (1,2,3) here as much as space you want to print before the line is printed.

  Space/After:  Type 0 or leave the field blank if you want no spaces after the line is printed. Type the number (1,2,3) here as much as space you want to print after the line is printed.                            

        Skip /Before: Choose from the following                                    

       1-99

o   Type a value from 1 to 99 if you want to skip to a specified line number before printing a line.                         

 A0-A9

o   Type a value from A0 to A9 if you want to skip to a specified line number between 100 and 109 before printing a line.                                                       

 3.   B0-B2

o   Type a value from B0 to B2 if you want to skip to a specified line number between 110 and112 before printing a line.                                                                                                                

 Skip /After: Choose from the following                                    

        

First we will study different type of prompt used in the Printer Files:


1)    IPIX

2)    IPJX

3)    IPO

4)    IPP


IPIX:


IX Specification line is broken into following parts

Positions
Name
Entry
1-2
Page
Page number
3-5
Line
Line number
6
Form type
I
7-14
Record name
Record format name
15-18

Blank
19-20
Record Identifying indicators
Blank
01-99
L1-L9,LR
H1-H9
U1-U8
RT
21-74

Blank
75-80
Comments
Optional

Record name: Type the external name of the record format.

 Record Identifying indicators:  Type a value from 01 to 99 to represent a general indicator. 

IPJX:

 JX Specification line is broken into following parts

Positions
Name
Entry
7-20

Blank
21-30
External field name
Field name
31-52

Blank
53-58
RPG field name
Field name
59-60
Control level
Blank
L1-L9
61-62
Match fields
Blank
M1-M9
63-64

Blank
65-70
Field indictors
Blank
01-99
H1-H9
U1-U8
RT
71-74

Blank
75-80
Comments
Optional

RPG Field Name: Type the name of the field as defined in the external record description (if six characters or fewer), or the name that replaces the external field name defined in positions 21 through 30.  
 Control level:  Type a value from L1 to L9 if this field is a control field.
 IPO:
O Specification line is broken into following parts

Positions
Name
Entry
1-2
Page
Page number
3-5
Line
Line number
6
Form type
O
7-14
File name
Valid file name
14-16
AND/OR
AND or OR
15
Type
H or D
T
E
16-18
ADD/DEL
ADD
DEL
16
Fetch overflow
Release
Blank
F
R
17
Space before
0 or blank
1
2
3
18
Space after
0 or blank
1
2
3
19-20
Skip before
1-99
A0-A9
B0-B2
21-22
Skip after
1-99
A0-A9
B0-B2
23-31
Output indicators
Blank
1-99
KA-KN,KP-KY
L1-L9
H1-H9
U1-U8
OA-OG,OV
MR
LR
RT
1P
32-37
EXCPT name
Record group name
38-74

Blank
75-80

Optional

Filename: Type the name of the output file.

 Type:    Choose from the following          

1)   H or D                                                               

o   Type H if you want header records or D if you want detail records.

2)   T                                                                    

o   Type T if you want total records.

3)   E                                                                     

o   Type E if you want exception records.                            

  Space/ Before: Type 0 or leave the field blank if you want no spaces before the line is printed. Type the number (1,2,3) here as much as space you want to print before the line is printed.

  Space/After:  Type 0 or leave the field blank if you want no spaces after the line is printed. Type the number (1,2,3) here as much as space you want to print after the line is printed.                            

        Skip /Before: Choose from the following                                    

       1-99

o   Type a value from 1 to 99 if you want to skip to a specified line number before printing a line.                         

 A0-A9

o   Type a value from A0 to A9 if you want to skip to a specified line number between 100 and 109 before printing a line.                                                       

 3.   B0-B2

o   Type a value from B0 to B2 if you want to skip to a specified line number between 110 and112 before printing a line.                                                       

 Skip /After: Choose from the following                                    

        1-99

o   Type a value from 1 to 99 if you want to skip to a specified line number after printing a line.                                                                                                                  

 A0-A9

o   Type a value from A0 to A9 if you want to skip to a specified line number between 100 and 109 after printing a line.       

 3.   B0-B2

o   Type a value from B0 to B2 if you want to skip to a specified line number between 110 and 112 after printing a line.            

N01N02N03: The output record is written if the indicator specified in this field is satisfied.    

 EXCPT Name: Type a record group name to specify exception records to be written.                                 

IPP:

 P Specification line is broken into following parts

Positions
Name
Entry
7-22

Blank
23-31
Field output indicators
See output indicators
32-37
Field name
Valid field name

*ALL
38

Blank
39
Blank after
Blank
B
40-74

Blank
75-80

Optional

Field Name: Type a valid field name chosen from any field name previously defined in the program. A named constant is also valid here.

 Edit Code: Choose from the following      

1.   Blank                               

    • Leave the field blank if no edit code is used.                  

2.   1-9, A-D, J-Q, X, Y, Z              

    • Type a value from the above if you want numeric fields zero-suppressed and punctuated according to a predefined pattern without the use of edit words.     

 End Position:  Choose from the following

 1.   Blanks, +nnn, nnnn

    • Type one of the above values to define the end position of a field or constant in the output record.
 K1-K8  
o    Type a value from K1 to K8 to indicate the length of the format name for a WORKSTN file.
 Constant / Edit Word:
Type a constant, a named constant, or an edit word.        

  Indicators Used In Printer Files:     

 First Page Indicator (1P) or internal indicator

    This indicator is used for:
·         Doing first page output for printer file

 Overflow Indicator (OA-OG, OV)

    These indicators are used for
·         Doing Conditional calculation on page break
·         Doing Conditional output on page brake

 Control Level Indicator (L1-L9)

9 These Indicators are used for:
·   Defining various Control Breaks
·   Doing Conditional Calculations
·   Doing Conditional Output

   Printer File Through RPG Logic Cycle: DDS For The Data Base File(SALE):


Columns . . . :    1  71            Edit                        PB01U01D/MYDDS
 SEU==>                                                                    SALE
 FMT A* .....A*. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 
        *************** Beginning of data *************************************
0000.01 ********************************************************************** 
0000.02       *           SALES MASTER                                         
0000.03 ********************************************************************** 
0002.00      A          R  SALER                                                
0003.00      A              CON           10          COLHDG('COUNTRY NAME')     
0004.00      A              STA            10          COLHDG('STATE NAME')       
0005.00      A              CTY           10          COLHDG('CITY NAME')        
0006.00      A              QTY           10          COLHDG('TOATAL QTY SOLD')  
0007.00      A          K CON                                                  
0008.00      A          K STA                                                  
0009.00      A          K CTY                                                   
        ****************** End of data ****************************************
                                                                               
                                                                                                       
 F3=Exit   F4=Prompt   F5=Refresh   F9=Retrieve   F10=Cursor   F11=Toggle      
 F16=Repeat find       F17=Repeat change          F24=More keys                
                                                                                                 

Create a Printer File By Using the Command Create Printer File (CRTPRTF)

CRTPRTF FILE(PB01U01/PRINT1) PAGESIZE(66 80) OVRFLW(60)

                                              Create Printer File (CRTPRTF)                        
                                                                                
 Type choices, press Enter.                                                    
                                                                               
File . . . . . . . . . . . . . . > PRINT1            Name                         
Library  . . . . . . . . . . . >   PB01U01O     Name, *CURLIB                
Source file  . . . . . . . . . .   *NONE          Name, *NONE                  
Library  . . . . . . . . . . .                 Name, *LIBL, *CURLIB         
Source member  . . . . . . . . .   *FILE        Name, *FILE                  
Generation severity level  . . .   20            0-30                         
Flagging severity level  . . . .   0                0-30                          
Device:                                                                       
Printer  . . . . . . . . . . .   *JOB             Name, *JOB, *SYSVAL          
Printer device type  . . . . . .   *SCS          *SCS, *IPDS, *LINE...         
Text 'description' . . . . . . .   *SRCMBRTXT                                 
                                                                               
                                                                               
                                                                                                 
                                                                        More...
 F3=Exit   F4=Prompt   F5=Refresh   F10=Additional parameters   F12=Cancel     
 F13=How to use this display        F24=More keys                              
                                                                                

Press Page Down

                                          Create Printer File (CRTPRTF)                        
                                                                               
 Type choices, press Enter.                                                     
                                                                               
                                                                               
                                        Additional Parameters                              
                                                                               
Page size:                                                                    
Length--lines per page . . . . > 66            .001-255.000                 
Width--positions per line  . . > 80            .001-378.000                 
Measurement method . . . . . .   *ROWCOL       *ROWCOL, *UOM                
Overflow line number . . . . . . > 60            1-255                         
                                                                               
                                                                                                                                                                
                                                                         Bottom
 F3=Exit   F4=Prompt   F5=Refresh   F10=Additional parameters   F12=Cancel     
 F13=How to use this display        F24=More keys                              
                                                                               

RPG Program For Printer File in O-Spec(Program Cycle): 

Columns . . . :    1  71            Edit                        PB01U01S/MYRPG
 SEU==>                                                                  LOGCLE
 FMT FX .....FFilenameIPEAF........L..I........Device+......KExit++Entry+A....U
        *************** Beginning of data *************************************
0001.00      FSALE    IP  E           K        DISK                            
0002.00      FPRINT1  O   F      80     OA     PRINTER                         
0002.01       *IPIX PROMPT                                                     
0002.02       * 01 IS THE RECORD IDENTIFYING INDICATOR DEFINED FOR RECORD      
0002.03       * FORMAT 'SALER' OF PHYSICAL FILE SALE                           
0002.04       * WHEN EVER THE RECORD IS READ FROM PHYSICAL FILE IT SETS        
0002.05       * ON AUTOMATICALLY                                               
0003.00      ISALER       01                                                   
0003.01       * IPO PROMPT                                                      
0003.02       * TO PRINT THE HEADER OF THE  REPORT                             
0003.03       *                                                                
0004.00      OPRINT1  H 11           1P                                         
0005.00      O       OR              OA                                        
0006.00      O                                   50 'SALES REPORT'             
0007.00      O                                   65 'PAGE:'                    
0008.00      O                         PAGE      69                            
0009.00      OPRINT1  H 11           1P                                        
0010.00      O       OR              OA                                         
0011.00      O                                   50 '============'             
0012.00      OPRINT1  H 11           1P                                        
0013.00      O       OR              OA                                        
0014.00      O                                   10 'COUNTRY'                  
0015.00      O                                   30 'STATE'                    
0016.00      O                                   50 'CITY'                     
0016.01      O                                   70 'SALES'                    
0016.02       * DETAIL TIME OUTPUT                                             
0017.00      OPRINT1  D 11           01                                        
0017.01       *IPP                                                              
0017.02      O                         CON       15                            
0018.00      O                         STA       35                            
0019.00      O                         CTY       55                            
0020.00      O                         QTY       75                            
        ****************** End of data ****************************************
                                                                                
                                                                               
 F3=Exit   F4=Prompt   F5=Refresh   F9=Retrieve   F10=Cursor   F11=Toggle      
 F16=Repeat find       F17=Repeat change          F24=More keys                 
                                                                               

RPG Program For Printer File in O-Spec(User controlled Logic Cycle):

Columns . . . :    1  71            Edit                        PB01U01S/MYRPG
 SEU==>                                                                 USERCYC
 FMT FX .....FFilenameIPEAF........L..I........Device+......KExit++Entry+A....U
        *************** Beginning of data *************************************
0001.00      FSALE    IF  E           K        DISK                            
0002.00      FPRINT1  O   F      80     OA     PRINTER                         
0002.01      C                     EXCPTHED1                                   
0002.02      C                     EXCPTHED2                                   
0002.03      C                     EXCPTHED3                                   
0002.04      C                     READ SALE                     90            
0002.05      C      *IN90     DOWEQ*OFF                                    
0002.06      C                     EXCPTDETAIL                                 
0002.07      C                     READ SALE                     90            
0002.08      C                     ENDDO                                        
0002.09      C                     SETON                                       LR                
0002.10       *IPO PROMPT                                                      
0004.00      OPRINT1  E 11             HED1                                     
0006.00      O                                   50 'SALES REPORT'             
0007.00      O                                   65 'PAGE:'                    
0008.00      O                         PAGE      69                            
0009.00      OPRINT1  E 11             HED2                                    
0011.00      O                                   50 '============'             
0012.00      OPRINT1  E 11             HED3                                    
0014.00      O                                   10 'COUNTRY'                  
0015.00      O                                   30 'STATE'                    
0016.00      O                                   50 'CITY'                     
0016.01      O                                   70 'SALES'                    
0016.02       * DETAIL TIME OUTPUT                                             
0017.00      OPRINT1  E 11             DETAIL                                  
0017.01       *IPP                                                              
0017.02      O                         CON       15                            
0018.00      O                         STA       35                            
0019.00      O                         CTY       55                             
0020.00      O                         QTY       75                            
        ****************** End of data ****************************************
                                                                                
                                                                                                                                                         
 F3=Exit   F4=Prompt   F5=Refresh   F9=Retrieve   F10=Cursor   F11=Toggle      
 F16=Repeat find       F17=Repeat change          F24=More keys                
                                                                               

 EXCPT: EXCPT opcode writes record during calculation time and it also facilitates a variable number of records to be written in one program cycle at either detail calculation or total calculation time. An E in position 15 of output spec identifies exception records. 

Level Break In Printer File:

Columns . . . :    1  71            Edit                        PB01U01S/MYRPG
 SEU==>                                                                  BREAK
 FMT FX .....FFilenameIPEAF........L..I........Device+......KExit++Entry+A....U
        *************** Beginning of data *************************************
0001.00      FSALE    IP  E           K        DISK                            
0002.00      FPRINT1  O   F      80     OA     PRINTER                          
0002.01       *IPIX PROMPT                                                     
0002.02      ISALER       01                                                   
0002.03      I                                              CON   L3           
0002.04      I                                              STA   L2           
0002.05      I                                              CTY   L1           
0002.06       *FOR EVERY RECORD READ ADD QUANTITY TO CITY QUANTITY             
0002.07      C                     ADD  QTY       CQTY    70                   
0002.08       *WHEN CITY CHANGES ADD CITY QUANTITY TO STATE QUANTITY           
0002.09      CL1                   ADD  CQTY      SQTY    70                   
0002.11       *WHEN STATE CHANGES ADD STATE QUANTITY TO COUNTRY QUANTITY       
0002.12      CL2                   ADD  SQTY      CUQTY   70                   
0002.13       *WHEN COUNTRY CHANGES ADD COUNTRY QUANTITY TO NET QUANTITY       
0002.14      CL3                   ADD  CUQTY     TQTY    70                   
0003.01       * IPO PROMPT                                                     
0003.02       * TO PRINT THE HEADER OF THE  REPORT                             
0003.03       *                                                                 
0004.00      OPRINT1  H 11           1P                                        
0005.00      O       OR              OA                                        
0006.00      O                                   50 'SALES REPORT'              
0007.00      O                                   65 'PAGE:'                    
0008.00      O                         PAGE      69                            
0009.00      OPRINT1  H 11           1P                                        
0010.00      O       OR              OA                                        
0011.00      O                                   50 '============'             
0012.00      OPRINT1  H 11           1P                                        
0013.00      O       OR              OA                                        
0014.00      O                                   10 'COUNTRY'                  
0015.00      O                                   30 'STATE'                    
0016.00      O                                   50 'CITY'                     
0016.01      O                                   70 'SALES'                    
0016.02       * DETAIL TIME OUTPUT                                             
0017.00      OPRINT1  D 11           01                                         
0017.01       *IPP                                                             
0017.02      O                         CON       15                            
0018.00      O                         STA       35                             
0019.00      O                         CTY       55                            
0020.00      O                         QTY   4   75                            
0021.00       *WHEN CITY CHANGES PRINT CITY TOTAL                               
0022.00      OPRINT1  T 11     L1                                              
0023.00      O                                   40 'CITY TOTAL'               
0023.01      O                         CQTY  4B  60                            
0024.00       *WHEN STATE CHANGES PRINT STATE TOTAL                            
0025.00      OPRINT1  T 11     L2                                              
0026.00      O                                   40 'STATE TOTAL'              
0026.01      O                         SQTY  4B  60                            
0027.00       *WHEN COUNTRY CANGES PRINT COUNTRY  TOTAL                        
0028.00      OPRINT1  T 11     L3                                              
0029.00      O                                   40 'COUNTRY TOTAL'            
0029.01      O                         CUQTY 4B  60                            
0030.00       *AFTER ALL RECORDS PROCESSED,PRINT THE NET TOTAL                 
0031.00      OPRINT1  T 11     LR                                               
0032.00      O                                   40 'NET TOTAL'                
0033.00      O                         TQTY  4   60                            
        ****************** End of data ****************************************

 F3=Exit   F4=Prompt   F5=Refresh   F9=Retrieve   F10=Cursor   F11=Toggle      
 F16=Repeat find       F17=Repeat change          F24=More keys                           

 o   Type a value from 1 to 99 if you want to skip to a specified line number after printing a line.                                                                                                                  

 A0-A9

o   Type a value from A0 to A9 if you want to skip to a specified line number between 100 and 109 after printing a line.       

 3.   B0-B2

o   Type a value from B0 to B2 if you want to skip to a specified line number between 110 and 112 after printing a line.           

N01N02N03: The output record is written if the indicator specified in this field is satisfied.    

 EXCPT Name: Type a record group name to specify exception records to be written.                                                                              

IPP:

 P Specification line is broken into following parts

Positions
Name
Entry
7-22

Blank
23-31
Field output indicators
See output indicators
32-37
Field name
Valid field name

*ALL
38

Blank
39
Blank after
Blank
B
40-74

Blank
75-80

Optional

Field Name: Type a valid field name chosen from any field name previously defined in the program. A named constant is also valid here.

 Edit Code: Choose from the following      

1.   Blank                               

    • Leave the field blank if no edit code is used.                    

2.   1-9, A-D, J-Q, X, Y, Z              

    • Type a value from the above if you want numeric fields zero-suppressed and punctuated according to a predefined pattern without the use of edit words.     

 End Position:  Choose from the following

 1.   Blanks, +nnn, nnnn

    • Type one of the above values to define the end position of a field or constant in the output record.
  1. K1-K8  
o    Type a value from K1 to K8 to indicate the length of the format name for a WORKSTN file.
 Constant / Edit Word:
Type a constant, a named constant, or an edit word.        

  Indicators Used In Printer Files:     

 First Page Indicator (1P) or internal indicator

    This indicator is used for:
·         Doing first page output for printer file

 Overflow Indicator (OA-OG, OV)

    These indicators are used for
·         Doing Conditional calculation on page break
·         Doing Conditional output on page brake

 Control Level Indicator (L1-L9)

9 These Indicators are used for:
·   Defining various Control Breaks
·   Doing Conditional Calculations
·   Doing Conditional Output

  Printer File Through RPG Logic Cycle:  

 DDS For The Data Base File(SALE):

Columns . . . :    1  71            Edit                        PB01U01D/MYDDS
 SEU==>                                                                    SALE
 FMT A* .....A*. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 
        *************** Beginning of data *************************************
0000.01 ********************************************************************** 
0000.02       *           SALES MASTER                                         
0000.03 ********************************************************************** 
0002.00      A          R SALER                                                
0003.00      A              CON           10          COLHDG('COUNTRY NAME')     
0004.00      A              STA             10          COLHDG('STATE NAME')       
0005.00      A              CTY            10          COLHDG('CITY NAME')        
0006.00      A              QTY            10          COLHDG('TOATAL QTY SOLD')  
0007.00      A          K CON                                                  
0008.00      A          K STA                                                  
0009.00      A          K CTY                                                   
        ****************** End of data ****************************************
                                                                               
                                                                                 
 F3=Exit   F4=Prompt   F5=Refresh   F9=Retrieve   F10=Cursor   F11=Toggle      
 F16=Repeat find       F17=Repeat change          F24=More keys                
                                                                                                 

 Create a Printer File By Using the Command Create Printer File (CRTPRTF)
  
CRTPRTF FILE(PB01U01/PRINT1) PAGESIZE(66 80) OVRFLW(60)

                                                   Create Printer File (CRTPRTF)                        
                                                                                
 Type choices, press Enter.                                                    
                                                                               
File . . . . . . . . . . . . . . > PRINT1            Name                         
Library  . . . . . . . . . . . >   PB01U01O    Name, *CURLIB                
Source file  . . . . . . . . . .   *NONE          Name, *NONE                  
Library  . . . . . . . . . . .                 Name, *LIBL, *CURLIB         
Source member  . . . . . . . . .   *FILE         Name, *FILE                  
Generation severity level  . . .   20            0-30                         
Flagging severity level  . . . .   0             0-30                          
Device:                                                                       
Printer  . . . . . . . . . . .   *JOB          Name, *JOB, *SYSVAL          
Printer device type  . . . . . .   *SCS          *SCS, *IPDS, *LINE...         
Text 'description' . . . . . . .   *SRCMBRTXT                                 
                                                                               
                                                                                                                                           
                                                                        More...
 F3=Exit   F4=Prompt   F5=Refresh   F10=Additional parameters   F12=Cancel     
 F13=How to use this display        F24=More keys                              
                                                                                

Press Page Down

                                                    Create Printer File (CRTPRTF)                        
                                                                               
 Type choices, press Enter.                                                     
                                                                               
                                                                               
                                               Additional Parameters                              
                                                                               
 Page size:                                                                    
   Length--lines per page . . . . > 66            .001-255.000                 
   Width--positions per line  . . > 80            .001-378.000                 
   Measurement method . . . . . .   *ROWCOL       *ROWCOL, *UOM                
 Overflow line number . . . . . . > 60            1-255                         
                                                                               
                                                                                                                                                 
                                                                               
                                                                         Bottom
 F3=Exit   F4=Prompt   F5=Refresh   F10=Additional parameters   F12=Cancel     
 F13=How to use this display        F24=More keys                              
                                                                               
 RPG Program For Printer File in O-Spec(Program Cycle):

Columns . . . :    1  71            Edit                        PB01U01S/MYRPG
 SEU==>                                                                  LOGCLE
 FMT FX .....FFilenameIPEAF........L..I........Device+......KExit++Entry+A....U
        *************** Beginning of data *************************************
0001.00      FSALE    IP  E           K        DISK                            
0002.00      FPRINT1  O   F      80     OA     PRINTER                         
0002.01       *IPIX PROMPT                                                     
0002.02       * 01 IS THE RECORD IDENTIFYING INDICATOR DEFINED FOR RECORD      
0002.03       * FORMAT 'SALER' OF PHYSICAL FILE SALE                           
0002.04       * WHEN EVER THE RECORD IS READ FROM PHYSICAL FILE IT SETS        
0002.05       * ON AUTOMATICALLY                                               
0003.00      ISALER       01                                                   
0003.01       * IPO PROMPT                                                      
0003.02       * TO PRINT THE HEADER OF THE  REPORT                             
0003.03       *                                                                
0004.00      OPRINT1  H 11           1P                                         
0005.00      O       OR              OA                                        
0006.00      O                                   50 'SALES REPORT'             
0007.00      O                                   65 'PAGE:'                    
0008.00      O                         PAGE      69                            
0009.00      OPRINT1  H 11           1P                                        
0010.00      O       OR              OA                                         
0011.00      O                                   50 '============'             
0012.00      OPRINT1  H 11           1P                                        
0013.00      O       OR              OA                                        
0014.00      O                                   10 'COUNTRY'                  
0015.00      O                                   30 'STATE'                    
0016.00      O                                   50 'CITY'                     
0016.01      O                                   70 'SALES'                    
0016.02       * DETAIL TIME OUTPUT                                             
0017.00      OPRINT1  D 11           01                                        
0017.01       *IPP                                                              
0017.02      O                         CON       15                            
0018.00      O                         STA       35                            
0019.00      O                         CTY       55                            
0020.00      O                         QTY       75                            
        ****************** End of data ****************************************
                                                                                
                                                                               
 F3=Exit   F4=Prompt   F5=Refresh   F9=Retrieve   F10=Cursor   F11=Toggle      
 F16=Repeat find       F17=Repeat change          F24=More keys                 
                                                                               
 RPG Program For Printer File in O-Spec(User controlled Logic Cycle):

Columns . . . :    1  71            Edit                        PB01U01S/MYRPG
 SEU==>                                                                 USERCYC
 FMT FX .....FFilenameIPEAF........L..I........Device+......KExit++Entry+A....U
        *************** Beginning of data *************************************
0001.00      FSALE    IF  E           K        DISK                            
0002.00      FPRINT1  O   F      80     OA     PRINTER                         
0002.01      C                     EXCPTHED1                                   
0002.02      C                     EXCPTHED2                                   
0002.03      C                     EXCPTHED3                                   
0002.04      C                     READ SALE                     90            
0002.05      C     *IN90     DOWEQ*OFF                                    
0002.06      C                     EXCPTDETAIL                                 
0002.07      C                     READ SALE                     90            
0002.08      C                     ENDDO                                        
0002.09      C                     SETON                               LR                
0002.10       *IPO PROMPT                                                      
0004.00      OPRINT1  E 11             HED1                                     
0006.00      O                                   50 'SALES REPORT'             
0007.00      O                                   65 'PAGE:'                    
0008.00      O                         PAGE      69                            
0009.00      OPRINT1  E 11             HED2                                    
0011.00      O                                   50 '============'             
0012.00      OPRINT1  E 11             HED3                                    
0014.00      O                                   10 'COUNTRY'                  
0015.00      O                                   30 'STATE'                    
0016.00      O                                   50 'CITY'                     
0016.01      O                                   70 'SALES'                    
0016.02       * DETAIL TIME OUTPUT                                             
0017.00      OPRINT1  E 11             DETAIL                                  
0017.01       *IPP                                                              
0017.02      O                         CON       15                            
0018.00      O                         STA       35                            
0019.00      O                         CTY       55                             
0020.00      O                         QTY       75                            
        ****************** End of data ****************************************
                                                                                                     
 F3=Exit   F4=Prompt   F5=Refresh   F9=Retrieve   F10=Cursor   F11=Toggle      
 F16=Repeat find       F17=Repeat change          F24=More keys                
                                                                               
 EXCPT: EXCPT opcode writes record during calculation time and it also facilitates a variable number of records to be written in one program cycle at either detail calculation or total calculation time. An E in position 15 of output spec identifies exception records.

Level Break In Printer File:

Columns . . . :    1  71            Edit                        PB01U01S/MYRPG
 SEU==>                                                                  BREAK
 FMT FX .....FFilenameIPEAF........L..I........Device+......KExit++Entry+A....U
        *************** Beginning of data *************************************
0001.00      FSALE    IP  E           K        DISK                            
0002.00      FPRINT1  O   F      80     OA     PRINTER                          
0002.01       *IPIX PROMPT                                                     
0002.02      ISALER       01                                                   
0002.03      I                                              CON   L3           
0002.04      I                                              STA   L2           
0002.05      I                                              CTY   L1           
0002.06       *FOR EVERY RECORD READ ADD QUANTITY TO CITY QUANTITY             
0002.07      C                     ADD  QTY       CQTY    70                   
0002.08       *WHEN CITY CHANGES ADD CITY QUANTITY TO STATE QUANTITY           
0002.09      CL1                   ADD  CQTY      SQTY    70                   
0002.11       *WHEN STATE CHANGES ADD STATE QUANTITY TO COUNTRY QUANTITY       
0002.12      CL2                   ADD  SQTY      CUQTY   70                   
0002.13       *WHEN COUNTRY CHANGES ADD COUNTRY QUANTITY TO NET QUANTITY       
0002.14      CL3                   ADD  CUQTY     TQTY    70                   
0003.01       * IPO PROMPT                                                     
0003.02       * TO PRINT THE HEADER OF THE  REPORT                             
0003.03       *                                                                 
0004.00      OPRINT1  H 11           1P                                        
0005.00      O       OR              OA                                        
0006.00      O                                   50 'SALES REPORT'              
0007.00      O                                   65 'PAGE:'                    
0008.00      O                         PAGE      69                            
0009.00      OPRINT1  H 11           1P                                        
0010.00      O       OR              OA                                        
0011.00      O                                   50 '============'             
0012.00      OPRINT1  H 11           1P                                        
0013.00      O       OR              OA                                        
0014.00      O                                   10 'COUNTRY'                  
0015.00      O                                   30 'STATE'                    
0016.00      O                                   50 'CITY'                     
0016.01      O                                   70 'SALES'                    
0016.02       * DETAIL TIME OUTPUT                                             
0017.00      OPRINT1  D 11           01                                         
0017.01       *IPP                                                             
0017.02      O                         CON       15                            
0018.00      O                         STA       35                             
0019.00      O                         CTY       55                            
0020.00      O                         QTY   4   75                            
0021.00       *WHEN CITY CHANGES PRINT CITY TOTAL                               
0022.00      OPRINT1  T 11     L1                                              
0023.00      O                                   40 'CITY TOTAL'               
0023.01      O                         CQTY  4B  60                            
0024.00       *WHEN STATE CHANGES PRINT STATE TOTAL                            
0025.00      OPRINT1  T 11     L2                                              
0026.00      O                                   40 'STATE TOTAL'              
0026.01      O                         SQTY  4B  60                            
0027.00       *WHEN COUNTRY CANGES PRINT COUNTRY  TOTAL                        
0028.00      OPRINT1  T 11     L3                                              
0029.00      O                                   40 'COUNTRY TOTAL'            
0029.01      O                         CUQTY 4B  60                            
0030.00       *AFTER ALL RECORDS PROCESSED,PRINT THE NET TOTAL                 
0031.00      OPRINT1  T 11     LR                                               
0032.00      O                                   40 'NET TOTAL'                
0033.00      O                         TQTY  4   60                            
        ****************** End of data ****************************************

 F3=Exit   F4=Prompt   F5=Refresh   F9=Retrieve   F10=Cursor   F11=Toggle      
 F16=Repeat find       F17=Repeat change          F24=More keys                
                                                                                

No comments:

Post a Comment