RPG Programming with Printer Files

Preview:

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

Citation preview

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

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

Solve the SQL problem – F Spec change

KEYWORDS: RENAME(fileName:newRecName)

Defining a Spooled File

Filename: Name of the fileFT (File Type): OFD (File Designation): blankFF (File Format): EDEVICE: PrinterKEYWORDS: OFLIND(*IN01)

Rounding Numbers in RPG

Eval (h)

Eval (h) hourlyrate = hourlyrate * 1.07;

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

records in a file

To print lines on the Report…

• Write recordname

Report LogicInitialize Variables

Report LogicInitialize VariablesPrint the report heading

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

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

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

format the detail line

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

format the detail lineupdate the totals

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

format the detail lineupdate the totalsprint the detail line

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

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

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

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

Recommended