RPG Programming with Printer Files
description
Transcript of RPG Programming with Printer Files
![Page 1: RPG Programming with Printer Files](https://reader035.fdocuments.us/reader035/viewer/2022062221/56813a0e550346895da1e133/html5/thumbnails/1.jpg)
RPG Programming with Printer Files
Week 10
![Page 2: RPG Programming with Printer Files](https://reader035.fdocuments.us/reader035/viewer/2022062221/56813a0e550346895da1e133/html5/thumbnails/2.jpg)
Agenda
• RPG Programming with Printer Files• Test 2 today!!
![Page 3: RPG Programming with Printer Files](https://reader035.fdocuments.us/reader035/viewer/2022062221/56813a0e550346895da1e133/html5/thumbnails/3.jpg)
SQL and RPG
• When defining a table, SQL doesn’t follow the rules that the record format name must be different than the table name.
• RPG needs the two to be different
![Page 4: RPG Programming with Printer Files](https://reader035.fdocuments.us/reader035/viewer/2022062221/56813a0e550346895da1e133/html5/thumbnails/4.jpg)
Solve the SQL problem – F Spec change
Filename: This is where you type the pf or table nameFT (File Type): I O U CFD (File Designation): P R S T F
(we use blank or F)FF (File Format): F ERecord Length: blank or a numberRAT (Record Address Type): A D F K P D Z ( we use blank or K)DEVICE: Printer, Disk, WorkStn
![Page 5: RPG Programming with Printer Files](https://reader035.fdocuments.us/reader035/viewer/2022062221/56813a0e550346895da1e133/html5/thumbnails/5.jpg)
Solve the SQL problem – F Spec change
KEYWORDS: RENAME(fileName:newRecName)
![Page 6: RPG Programming with Printer Files](https://reader035.fdocuments.us/reader035/viewer/2022062221/56813a0e550346895da1e133/html5/thumbnails/6.jpg)
Defining a Spooled File
Filename: Name of the fileFT (File Type): OFD (File Designation): blankFF (File Format): EDEVICE: PrinterKEYWORDS: OFLIND(*IN01)
![Page 7: RPG Programming with Printer Files](https://reader035.fdocuments.us/reader035/viewer/2022062221/56813a0e550346895da1e133/html5/thumbnails/7.jpg)
Rounding Numbers in RPG
Eval (h)
Eval (h) hourlyrate = hourlyrate * 1.07;
![Page 8: RPG Programming with Printer Files](https://reader035.fdocuments.us/reader035/viewer/2022062221/56813a0e550346895da1e133/html5/thumbnails/8.jpg)
Logic for an RPG program that creates a report for all of the
records in a file
![Page 9: RPG Programming with Printer Files](https://reader035.fdocuments.us/reader035/viewer/2022062221/56813a0e550346895da1e133/html5/thumbnails/9.jpg)
To print lines on the Report…
• Write recordname
![Page 10: RPG Programming with Printer Files](https://reader035.fdocuments.us/reader035/viewer/2022062221/56813a0e550346895da1e133/html5/thumbnails/10.jpg)
Report LogicInitialize Variables
![Page 11: RPG Programming with Printer Files](https://reader035.fdocuments.us/reader035/viewer/2022062221/56813a0e550346895da1e133/html5/thumbnails/11.jpg)
Report LogicInitialize VariablesPrint the report heading
![Page 12: RPG Programming with Printer Files](https://reader035.fdocuments.us/reader035/viewer/2022062221/56813a0e550346895da1e133/html5/thumbnails/12.jpg)
Report LogicInitialize VariablesPrint the report headingRead the first record and check for EOF
![Page 13: RPG Programming with Printer Files](https://reader035.fdocuments.us/reader035/viewer/2022062221/56813a0e550346895da1e133/html5/thumbnails/13.jpg)
Report LogicInitialize VariablesPrint the report headingRead the first record and check for EOFLoop until EOF
![Page 14: RPG Programming with Printer Files](https://reader035.fdocuments.us/reader035/viewer/2022062221/56813a0e550346895da1e133/html5/thumbnails/14.jpg)
Report LogicInitialize VariablesPrint the report headingRead the first record and check for EOFLoop until EOF
format the detail line
![Page 15: RPG Programming with Printer Files](https://reader035.fdocuments.us/reader035/viewer/2022062221/56813a0e550346895da1e133/html5/thumbnails/15.jpg)
Report LogicInitialize VariablesPrint the report headingRead the first record and check for EOFLoop until EOF
format the detail lineupdate the totals
![Page 16: RPG Programming with Printer Files](https://reader035.fdocuments.us/reader035/viewer/2022062221/56813a0e550346895da1e133/html5/thumbnails/16.jpg)
Report LogicInitialize VariablesPrint the report headingRead the first record and check for EOFLoop until EOF
format the detail lineupdate the totalsprint the detail line
![Page 17: RPG Programming with Printer Files](https://reader035.fdocuments.us/reader035/viewer/2022062221/56813a0e550346895da1e133/html5/thumbnails/17.jpg)
Report LogicInitialize VariablesPrint the report headingRead the first record and check for EOFLoop until EOF
format the detail lineupdate the totalsprint the detail lineread the next record
![Page 18: RPG Programming with Printer Files](https://reader035.fdocuments.us/reader035/viewer/2022062221/56813a0e550346895da1e133/html5/thumbnails/18.jpg)
Report LogicInitialize VariablesPrint the report headingRead the first record and check for EOFLoop until EOF
format the detail lineupdate the totalsprint the detail lineread the next record
End of loop
![Page 19: RPG Programming with Printer Files](https://reader035.fdocuments.us/reader035/viewer/2022062221/56813a0e550346895da1e133/html5/thumbnails/19.jpg)
Report LogicInitialize VariablesPrint the report headingRead the first record and check for EOFLoop until EOF
format the detail lineupdate the totalsprint the detail lineread the next record
End of loopPrint the totals
![Page 20: RPG Programming with Printer Files](https://reader035.fdocuments.us/reader035/viewer/2022062221/56813a0e550346895da1e133/html5/thumbnails/20.jpg)
Report LogicInitialize VariablesPrint the report headingRead the first record and check for EOFLoop until EOF
format the detail lineupdate the totalsprint the detail lineread the next record
End of loopPrint the totalsEnd of program logic
![Page 21: RPG Programming with Printer Files](https://reader035.fdocuments.us/reader035/viewer/2022062221/56813a0e550346895da1e133/html5/thumbnails/21.jpg)