Ü Printer file
·
There
are two types of printer file:
A. Program described printer file
A printer file defined within an application program is
called a program
described printer file. This means that the file, record, and field descriptions are defined internally within the data
division. With this method, report specifications
are hard-coded
into
the program and become part of the program’s compiled object.
B. Externally described printer file
Printer files that contain report
specifications can be defined externally to any program that uses them. This
means that the report specifications for a printer file are described
separately from any programs and compiled into a printer file object (Type=PRTF).
Two ways of making Externally described
printer file:
B (1) è Externally described
printer file can be made directly using STRSEU.
B (2) è Externally described
printer file can be made directly using STRRLU.
Ø
Advantage of using an externally described printer file
o
Some changes can be made to a printer file without having to
recompile the program using it.
o
It eliminates the specifications necessary to define the report
within the program.
o
There are some software tools that will allow you to generate
reports and produce the DDS.
o
Several programs can share the same printer file.
Example-1: Program
described printer file
Columns . . . : 1 100 Browse
SEU==>
FMT FX .....FFilename++IPEASF.....L.....A.Device+.Keywords+++++++++++++++++++++++++++++
*************** Beginning of data **********************************************
0001.00 FACCOUNT UF A E K DISK
0002.00 FQPRINT O F 132 PRINTER OFLIND(*In90)
0003.00 *
0004.00 C EXCEPT HEADER
0005.00 C *LOVAL SETLL ACCOUNT
0006.00 C READ(N) ACCOUNT
0007.00 C DOW NOT %EOF(ACCOUNT)
0008.00 C IF *IN90=*ON
0009.00 C EXCEPT HEADER
0010.00 C ENDIF
0011.00 C EXCEPT DETAIL
0012.00 C READ(N) ACCOUNT
0013.00 C ENDDO
0014.00 C EXCEPT FOOTER
0015.00 C SETON LR
0016.00 *
0017.00 OQPRINT E HEADER
0018.00 O 6 'PAGE'
0019.00 O Page 10
0020.00 O 47 'PARTY ACCOUNT REPORT'
0021.00 O 65 'DATE'
0022.00 O Udate Y 75
0023.00 O E HEADER 1
0024.00 O 10 'ORG CODE'
0025.00 O 25 'ACCOUNT NO'
0026.00 O 36 'CURRENCY'
0027.00 O 52 'PARTY NAME'
0028.00 O E DETAIL 1
0029.00 O ORG 10
0030.00 O ACC 25
0031.00 O CCY 36
0032.00 O PARTY 52
0033.00 O E FOOTER 1
0034.00 O 42 '**************************'
****************** End of data ********************************************************
Physical
File used in the program: ACCOUNT
ORG ACC CCY PARTY
000001 190 A00000000001 CCY P00000000001
000002 191 A00000000002 EUR P00000000002
000003 192 A00000000003 USD P00000000003
000004 192 A00000000004 TRY P00000000004
000005 190 A00000000005 INR P00000000005
000006 190 A00000000006 TRY P00000000006
000007 192 A00000000007 INR P00000000007
000008 191 A00000000008 GBP P00000000002
000009 191 A00000000009 USD P00000000001
000010 195 A00000000010 EUR P00000000003
****** ******** End of report ********
OUTPUT
Display Spooled File
File . . . . . : QPRINT Page/Line 1/1
Control . . . . . Columns 1 - 130
Find . . . . . .
*...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9....+....0..
PAGE 1 PARTY ACCOUNT REPORT DATE 2/09/13
ORG CODE ACCOUNT NO CURRENCY PARTY NAME
190 A00000000001 CCY P00000000001
190 A00000000005 INR P00000000005
190 A00000000006 TRY P00000000006
191 A00000000002 EUR P00000000002
191 A00000000008 GBP P00000000002
191 A00000000009 USD P00000000001
192 A00000000003 USD P00000000003
192 A00000000004 TRY P00000000004
192 A00000000007 INR P00000000007
195 A00000000010 EUR P00000000003
**************************
Bottom
F3=Exit F12=Cancel F19=Left F20=Right F24=More keys
Example-2: Externally
described printer file using STRSEU
Columns . . . : 1 71 Browse AMIT/QRPGLESRC
SEU==> PRINT4
FMT A* .....A*. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7
*************** Beginning of data *************************************
0000.01 A*%%**************************************************************
0000.06 A R HEADER
0000.10 A 4
0000.11 A 'ORG'
0000.12 A +6
0000.13 A 'ACCOUNT NO'
0000.14 A +9
0000.15 A 'CCY'
0000.16 A +10
0000.17 A 'PARTY NO'
0000.20 A*%%**************************************************************
0000.21 A R DETAIL
0000.25 A SPACEB(001)
0000.26 A ORG R O 4
0000.27 A REFFLD(REC1/ORG AMIT/MASTER)
0000.28 A ACC R O +6
0000.29 A REFFLD(REC1/ACC AMIT/MASTER)
0000.30 A CCY R O +7
0000.31 A REFFLD(REC1/CCY AMIT/MASTER)
0000.32 A PARTY R O +10
0000.33 A REFFLD(REC1/PARTY AMIT/MAST
0000.36 A*%%**************************************************************
0000.37 A R FOOTER
0000.41 A SPACEB(001)
0000.42 A 13
0000.43 A 'TOTAL CUSTOMER FOUND = '
0000.44 A TOTAL 2S 0O +0
****************** End of data ****************************************
The designed screen by this DDS entry is
as shown below. To see the designed screen we take option-19 against this DDS source member.
Columns . . . : 1 71 Design Report AMIT/QRPGLESRC
RLU==> PRINT4
BASE ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7
------------------------- Start of Page 001 ---------------------------
FLD1 <.> <........> <.> <......>
HEADER ORG ACCOUNT NO CCY PARTY NO
FLD1 <.> <..........> <.> <..........>
DETAIL 999 XXXXXXXXXXXX XXX XXXXXXXXXXXX
FLD1 <.....................><>
FOOTER TOTAL CUSTOMER FOUND = 99
--------------------------- End of Report -----------------------------
F3=Exit F11=Define field F16=Delete field
F22=Alternative keys F24=More keys
Example-3: Externally
described printer file using STRRLU
Step(1)è STRRLU à Press F4 à src pf, lib, source member name PRINT3
Step(2)è I à DR(DEFINE RECORD) à VF(VIEW FIELD)à Press Enter
Columns . . . : 1 71 Design Report AMIT/QRPGLESRC
RLU==> PRINT4
BASE ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7
------------------------- Start of Page 001 ---------------------------
RCD001
--------------------------- End of Report -----------------------------
Columns . . . : 1 71 Design Report AMIT/QRPGLESRC
RLU==> PRINT4
BASE ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7
------------------------- Start of Page 001 ---------------------------
VFCD001
--------------------------- End of Report -----------------------------
Columns . . . : 1 71 Design Report AMIT/QRPGLESRC
RLU==> PRINT4
BASE ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7
------------------------- Start of Page 001 ---------------------------
FLD1
RCD001
--------------------------- End of Report -----------------------------
Step(3)è On FLD1 write ‘ORG’
‘ACCOUNT NO’ ‘CCY’ ‘PARTY NO’ à Press Enter
Columns . . . : 1 71 Design Report AMIT/QRPGLESRC
RLU==> PRINT4
BASE ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7
------------------------- Start of Page 001 ---------------------------
FLD1 'ORG' 'ACCOUNT NO' 'CCY' 'PARTY NO'
RCD001
--------------------------- End of Report -----------------------------
Columns . . . : 1 71 Design Report AMIT/QRPGLESRC
RLU==> PRINT4
BASE ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7
------------------------- Start of Page 001 ---------------------------
FLD1 <.> <........> <.> <......>
RCD001 ORG ACCOUNT NO CCY PARTY NO
--------------------------- End of Report -----------------------------
Step(4)è Repeat Step(2)
Columns . . . : 1 71 Design Report AMIT/QRPGLESRC
RLU==> PRINT4
BASE ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7
------------------------- Start of Page 001 ---------------------------
FLD1 <.> <........> <.> <......>
IRCD001 ORG ACCOUNT NO CCY PARTY NO
--------------------------- End of Report -----------------------------
Columns . . . : 1 71 Design Report AMIT/QRPGLESRC
RLU==> PRINT4
BASE ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7
------------------------- Start of Page 001 ---------------------------
FLD1 <.> <........> <.> <......>
RCD001 ORG ACCOUNT NO CCY PARTY NO
DR'''''
--------------------------- End of Report -----------------------------
Columns . . . : 1 71 Design Report AMIT/QRPGLESRC
RLU==> PRINT4
BASE ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7
------------------------- Start of Page 001 ---------------------------
FLD1 <.> <........> <.> <......>
RCD001 ORG ACCOUNT NO CCY PARTY NO
RCD002
--------------------------- End of Report -----------------------------
Columns . . . : 1 71 Design Report AMIT/QRPGLESRC
RLU==> PRINT4
BASE ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7
------------------------- Start of Page 001 ---------------------------
FLD1 <.> <........> <.> <......>
RCD001 ORG ACCOUNT NO CCY PARTY NO
VFCD002
--------------------------- End of Report -----------------------------
Columns . . . : 1 71 Design Report AMIT/QRPGLESRC
RLU==> PRINT4
BASE ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7
------------------------- Start of Page 001 ---------------------------
FLD1 <.> <........> <.> <......>
RCD001 ORG ACCOUNT NO CCY PARTY NO
FLD1
RCD002
--------------------------- End of Report -----------------------------
Step(5)è On FLD1 Press F10 à Give option 1 to select the fields
from database file MASTER à Press Enter à Press Enter à The selected field appears at the
bottom of the screen à Place the cursor at the FLD1 Line
where you want the field to appear à Press Enter. It will place the
field definition there.
FLD1 <......> <.........> <.> <.......>
HEADER ORG CODE ACCOUNT NO. CCY PARTY NO.
FLD1
DETAIL
Columns . . . : 1 71 Design Report AMIT/QRPGLESRC
RLU==> PRINT4
BASE ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7
------------------------- Start of Page 001 ---------------------------
FLD1 <.> <........> <.> <......>
RCD001 ORG ACCOUNT NO CCY PARTY NO
FLD1 3 1 2 4
RCD002
--------------------------- End of Report -----------------------------
1:ACC 2:CCY 3:ORG 4:PARTY >>>>>>>>>>>>>>>
F3=Exit F11=Define field F16=Delete field
F22=Alternative keys F24=More keys
Step(6)è Repeat Step(2) à F11 to define the field on FLD1 of RCD003.
Define Field Information
Edited length . . . . . . . . . . . . : 1
Record format . . . . . . . . . . . . : RCD003
Number of keywords . . . . . . . . . : 0
Number of indicators . . . . . . . . : 0
Type choices, press Enter.
Field . . . . . . . . . . . . . . . . TOTAL Name
Option indicators . . . . . . . . . . 01-99, N01-N99
More indicators . . . . . . . . . . N Y=Yes, N=No
Starting line . . . . . . . . . . . . 1-255
Starting position . . . . . . . . . . +11 1-255, +nn
Length of data . . . . . . . . . . . 2 1-378, +nn, -nn
More...
F3=Exit F5=Refresh F10=Work with keywords F11=Convert to constant field
F12=Cancel
Step(7)è To
rename the record press SHIFT F6 + F10. Rename RCD001 = HEADER, RCD002 =
DETAIL, RCD003 = FOOTER
Columns . . . : 1 71 Design Report AMIT/QRPGLESRC
RLU==> PRINT4
BASE ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7
------------------------- Start of Page 001 ---------------------------
FLD1 <.> <........> <.> <......>
HEADER ORG ACCOUNT NO CCY PARTY NO
FLD1 <.> <..........> <.> <..........>
DETAIL 999 XXXXXXXXXXXX XXX XXXXXXXXXXXX
FLD1 <.....................><>
FOOTER TOTAL CUSTOMER FOUND = 99
--------------------------- End of Report -----------------------------
F3=Exit F11=Define field F16=Delete field
F22=Alternative keys F24=More keys
Field TOTAL created in record format FOOTER.
Now
check the DDS generated by this RLU design.
DDS generated by RLU:
Columns . . . : 1 71 Browse AMIT/QRPGLESRC
SEU==> PRINT4
FMT A* .....A*. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7
*************** Beginning of data *************************************
0000.01 A*%%**************************************************************
0000.02 A*%%TS RD 20121019 021512 ARUN REL-V5R4M0 5722-WDS
0000.03 A*%%FI+10660100000000000000000000000000000000000000000000000000
0000.04 A*%%FI 0000000000000000000000000000000000000000000000000
0000.05 A*%%**************************************************************
0000.06 A R HEADER
0000.07 A*%%**************************************************************
0000.08 A*%%RI 00000
0000.09 A*%%**************************************************************
0000.10 A 4
0000.11 A 'ORG'
0000.12 A +6
0000.13 A 'ACCOUNT NO'
0000.14 A +9
0000.15 A 'CCY'
0000.16 A +10
0000.17 A 'PARTY NO'
0000.18 A*%%**************************************************************
0000.19 A*%%SS
0000.20 A*%%**************************************************************
0000.21 A R DETAIL
0000.22 A*%%**************************************************************
0000.23 A*%%RI 00000
0000.24 A*%%**************************************************************
0000.25 A SPACEB(001) >>>> By default
0000.26 A ORG R O 4
0000.27 A REFFLD(REC1/ORG AMIT/MASTER)
0000.28 A ACC R O +6
0000.29 A REFFLD(REC1/ACC AMIT/MASTER)
0000.30 A CCY R O +7
0000.31 A REFFLD(REC1/CCY AMIT/MASTER)
0000.32 A PARTY R O +10
0000.33 A REFFLD(REC1/PARTY AMIT/MAST
0000.34 A*%%**************************************************************
0000.35 A*%%SS
0000.36 A*%%**************************************************************
0000.37 A R FOOTER
0000.38 A*%%**************************************************************
0000.39 A*%%RI 00000
0000.40 A*%%**************************************************************
0000.41 A SPACEB(001) >>>> By default
0000.42 A 13
0000.43 A 'TOTAL CUSTOMER FOUND = '
0000.44 A TOTAL 2S 0O +0
0000.45 A*%%**************************************************************
0000.46 A*%%SS
0000.47 A*%%CP+999CRTPRTF
0000.48 A*%%CP+ FILE(AMIT/PRINT4)
0000.49 A*%%CP+ DEVTYPE(*SCS)
0000.50 A*%%CP PAGESIZE(*N 071 *N )
0000.51 A*%%**************************************************************
****************** End of data ****************************************
Program
Columns . . . : 1 71 Browse AMIT/QRPGLESRC
SEU==> PRINT4PGM
FMT FX .....FFilenameIPEAF........L..I........Device+......KExit++Entry+A....U
*************** Beginning of data *************************************
0001.00 FMASTER IF E K DISK
0002.00 FPRINT4 O E 90 PRINTER
0003.00 *
0003.01 *
0003.02 C Z-ADD0 COUNT 20
0005.00 C WRITEHEADER
0006.00 C READ REC1 80
0007.00 C *IN80 DOWEQ*OFF
0007.01 C WRITEDETAIL 90
0007.02 C 90 WRITEHEADER
0007.03 C ADD 1 COUNT
0007.04 C READ REC1 80
0008.00 C ENDDO
0008.01 C MOVELCOUNT TOTAL
0008.02 C WRITEFOOTER
0009.00 C SETON LR
****************** End of data ****************************************
OUTPUT
Display Spooled File
File . . . . . : PRINT4 Page/Line 1/1
Control . . . . . Columns 1 - 78
Find . . . . . .
*...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+...
ORG ACCOUNT NO CCY PARTY NO
190 A00000000001 EUR P00000000001
190 A00000000006 USD P00000000006
190 A00000000009 TRY P00000000009
191 A00000000002 USD P00000000002
191 A00000000004 EUR P00000000004
191 A00000000005 USD P00000000005
191 A00000000007 EUR P00000000007
191 A00000000008 USD P00000000008
TOTAL CUSTOMER FOUND = 08
Bottom
F3=Exit F12=Cancel F19=Left F20=Right F24=More keys