1 / 18

RPG IV

RPG IV. Getting Started - Chapter 2. Objectives :. Describe the RPG Specification forms Create a simple read/write RPG program Explain how to include comment lines in a program Explain how to do output editing to control the appearance of a report. Specifications in RPG IV.

dolores
Télécharger la présentation

RPG IV

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 IV Getting Started - Chapter 2

  2. Objectives: • Describe the RPG Specification forms • Create a simple read/write RPG program • Explain how to include comment lines in a program • Explain how to do output editing to control the appearance of a report

  3. Specifications in RPG IV • Different specifications for different purposes • File Description Specifications • Input Specifications • Definition Specifications • Calculation Specifications • Output Specifications

  4. File Description Specifications • File Name • File Type • File Designation • File Format • Record Length • Device

  5. Input Specifications • Record Identification Entries • File Name • Sequence • Field Description Entries • Field Location • Decimal Positions • Field Name

  6. Output Specifications • Record Identification Entries • File Name • Type • Exception Name • Space and Skip Entries • Field Description Entries • Field Name • Constants • End Position in Output Record • Edit Codes

  7. Pseudocode for Program

  8. Calculation Specifications • Except • Read • Dow • Enddo • Eval • Return

  9. Internal Documentation • Comment lines • * in position 7

  10. Completed Program - F & I *..1....+....2....+....3....+....4....+....5....+....6....+....7....+....8 F************************************************************************** F* This program produces a weekly sales report. The report data comes * F* directly from input file SalesMast. * F* Author: J. Yaeger Date Written: 12/10/94 * F************************************************************************** *..1....+....2....+....3....+....4....+....5....+....6....+....7....+....8 F*ilename++IP FRlen+ Device FSalesMast IF F 63 DISK FQPRINT O F 132 PRINTER *..1....+....2....+....3....+....4....+....5....+....6....+....7....+....8 I*ilename++Sq ISalesMast NS I* From+To+++DcField+++++++++ I 1 4 0SlspNumber I 5 34 SlspName I 35 50 ItemNumber I 51 56 0DateOfSale I 57 63 2Price

  11. Completed Program - C Spec *..1....+....2....+....3....+....4....+....5....+....6....+....7....+....8 C* Factor1+++++++Opcode(E)+Factor2+++++++Result++++++++Len++DcHiLoEq C EXCEPT Headings C READ SalesMast C DOW NOT %EOF C EXCEPT Detail C READ SalesMast C ENDDO C EVAL *INLR = *ON C RETURN

  12. Completed Program - O Headings Spec *..1....+....2....+....3....+....4....+....5....+....6....+....7....+....8 O*ilename++D ExceptnameB++A++Sb+Sa+ OQPRINT E Headings 2 2 *..1....+....2....+....3....+....4....+....5....+....6....+....7....+....8 O* Field+++++++++Y End++ Constant/Editword+++++++++++ O 8 'PAGE' O PAGE 13 O 50 'WEEKLY SALES REPORT' O 64 'DATE' O UDATE Y 73 O E Headings 1 O 7 'SLSPSN.' O 48 'DATE OF' O 77 'SALE' O E Headings 2 O 3 'NO.' O 21 'NAME' O 46 'SALE' O 61 'ITEM SOLD' O 77 'PRICE'

  13. Completed Program - O Detail Spec *..1....+....2....+....3....+....4....+....5....+....6....+....7....+....8 O*ilename++D ExceptnameB++A++Sb+Sa+ O E Detail 1 *..1....+....2....+....3....+....4....+....5....+....6....+....7....+....8 O* Field+++++++++Y End++ Constant/Editword+++++++++++ O SlspNumber 4 O SlspName 37 O DateOfSale Y 48 O ItemNumber 67 O Price 1 79

  14. Edit Codes

  15. Edit Words

  16. Points to Remember • RPG programs are written as fixed-form specifications. • Different specification forms convey different kinds of information to the RPG compiler • File Specifications contain descriptions of all files used within a program.

  17. Points to Remember (cont) • Input Specifications provide detail information about each program described input file used by a program. • Calculation Specifications center on operations, or processing steps, to be accomplished by the computer. • Output Specifications provide details about each program-described output file.

  18. Points to Remember (cont) • It generally is customary to edit numeric values that are printed. • Comment lines, signaled by an * in position 7 of a specification line, can appear anywhere within a program.

More Related