rpg programming with printer files

21
RPG Programming with Printer Files Week 10

Upload: teague

Post on 05-Jan-2016

50 views

Category:

Documents


2 download

DESCRIPTION

RPG Programming with Printer Files. Week 10. Agenda. RPG Programming with Printer Files Test 2 today!!. 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. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: RPG Programming with Printer Files

RPG Programming with Printer Files

Week 10

Page 2: RPG Programming with Printer Files

Agenda

• RPG Programming with Printer Files• Test 2 today!!

Page 3: RPG Programming with Printer Files

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

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

Solve the SQL problem – F Spec change

KEYWORDS: RENAME(fileName:newRecName)

Page 6: RPG Programming with Printer Files

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

Rounding Numbers in RPG

Eval (h)

Eval (h) hourlyrate = hourlyrate * 1.07;

Page 8: RPG Programming with Printer Files

Logic for an RPG program that creates a report for all of the

records in a file

Page 9: RPG Programming with Printer Files

To print lines on the Report…

• Write recordname

Page 10: RPG Programming with Printer Files

Report LogicInitialize Variables

Page 11: RPG Programming with Printer Files

Report LogicInitialize VariablesPrint the report heading

Page 12: RPG Programming with Printer Files

Report LogicInitialize VariablesPrint the report headingRead the first record and check for EOF

Page 13: RPG Programming with Printer Files

Report LogicInitialize VariablesPrint the report headingRead the first record and check for EOFLoop until EOF

Page 14: RPG Programming with Printer Files

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

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

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

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

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

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

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