1 / 21

RPG Programming with Printer Files

This agenda covers the intricacies of RPG programming with printer files, focusing on SQL table definitions and how they differ from RPG record formats. Learn about the specific requirements for naming conventions in RPG and SQL, including file designations and types. The course also includes logic for creating reports from database records, encompassing initialization, printing headings, and processing detail lines. By the end, you'll be equipped to effectively manage file formatting and database integration in RPG.

zariel
Télécharger la présentation

RPG Programming with Printer Files

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. RPG Programming with Printer Files Week 10

  2. Agenda • RPG Programming with Printer Files

  3. 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

  4. Solve the SQL problem – F Spec change Filename: This is where you type the pf or table name FT (File Type): I O U C FD (File Designation): P R S T F (we use blank or F) FF (File Format): F E Record Length: blank or a number RAT (Record Address Type): A D F K P D Z ( we use blank or K) DEVICE: Printer, Disk, WorkStn

  5. Solve the SQL problem – F Spec change KEYWORDS: RENAME(fileName:newRecName)

  6. Defining a Spooled File Filename: Name of the file FT (File Type): O FD (File Designation): blank FF (File Format): E DEVICE: Printer KEYWORDS: OFLIND(*IN01)

  7. Rounding Numbers in RPG Eval (h) Eval (h) hourlyrate = hourlyrate * 1.07;

  8. Logic for an RPG program that creates a report for all of the records in a file

  9. To print lines on the Report… • Write recordname

  10. Report Logic Initialize Variables

  11. Report Logic Initialize Variables Print the report heading

  12. Report Logic Initialize Variables Print the report heading Read the first record and check for EOF

  13. Report Logic Initialize Variables Print the report heading Read the first record and check for EOF Loop until EOF

  14. Report Logic Initialize Variables Print the report heading Read the first record and check for EOF Loop until EOF format the detail line

  15. Report Logic Initialize Variables Print the report heading Read the first record and check for EOF Loop until EOF format the detail line update the totals

  16. Report Logic Initialize Variables Print the report heading Read the first record and check for EOF Loop until EOF format the detail line update the totals print the detail line

  17. Report Logic Initialize Variables Print the report heading Read the first record and check for EOF Loop until EOF format the detail line update the totals print the detail line read the next record

  18. Report Logic Initialize Variables Print the report heading Read the first record and check for EOF Loop until EOF format the detail line update the totals print the detail line read the next record End of loop

  19. Report Logic Initialize Variables Print the report heading Read the first record and check for EOF Loop until EOF format the detail line update the totals print the detail line read the next record End of loop Print the totals

  20. Report Logic Initialize Variables Print the report heading Read the first record and check for EOF Loop until EOF format the detail line update the totals print the detail line read the next record End of loop Print the totals End of program logic

More Related