INF-107 - Minicomputer Operations
Class Thirteen - Chapters 20 & 21 – RPG (Continued)
  1. Positioning RPG
    1. Strengths of RPG
      1. Data Processing applications
        1. Record based approach
          1. Good for DP, but you wouldn't want to write a word processor using RPG
        2. Easy to learn
        3. Easy to build applications for:
          1. Batch processing (reporting, for example)
          2. Interactive applications
          3. Web based applications
      2. Valued highly in the marketplace ($$$$$)
        1. High programmer productivity
        2. Continuing marketplace needs
        3. Most valuable when coupled with business knowledge
    2. Weaknesses of RPG
      1. Character based client oriented
        1. You can write terminal programs with mouse sensitivity, action bars, & integrated HTML code
        2. A lot of tool vendors sell Graphical User Interface (GUI) tools to give legacy code a "GUI look"
        3. Visual RPG
          1. exists in the form of two products (one from IBM and one independent of IBM)
          2. has not been widely adapted in the marketplace.
      2. Perceived as very "IBM oriented"
        1. You can port IBM iSeries eServer (AS/400) RPG programs to:
          1. PC
          2. Unix
        2. Would you want to?
  2. RPG Calculation Specifications
    1. Operation Codes
      1. How you specify "what to do" in a program
      2. Types of Operations
        1. Arithmetic
        2. Logic
        3. Data manipulation
        4. Input / Output
    2. Indicators
      1. "Switches" which are set on & off
      2. Logical variables (True / False) - (On / Off) - (1 / 0)
      3. Primary uses
        1. Logical variables in programs
          1. 01 to 99 - General Purpose Indicators
        2. Communicating with external device files
          1. Display files
            1. KA to KN, KP to KY - Function key pressed on display file
          2. Printer Files
            1. 1P - First Page of a report
            2. OA to OG, OF - Print overflow (printed report reaches the bottom of the page)
        3. Receiving status information from logic cycle processes
          1. L1 to L9 - Control break levels
          2. LR - Last Record
          3. MR - Matching record
  3. RPG Applications Logic
    1. Two methods
      1. RPG Logic Cycle
        1. RPG provides the logic
        2. ONE "F (File) Specification" has a "P" in Column 16 (type of processing)
      2. Full procedural logic
        1. YOU must provide all of the logic
        2. ALL "F (File) Specifications" have an "F" in Column 16 (type of processing)
    2. RPG Logic Cycle (See flowchart on Page 400)
      1. Contains "standard logic" for batch, record oriented programs.
        1. Handles reading a file of records sequentially, determining summary breaks, calculating totals
        2. Also "matches records" from a "primary" and a "secondary" file
      2. Types of programs served best by the logic cycle
        1. Report programs
        2. Sequential batch "Matching Records" programs
    3. Full Procedural Logic
      1. You control the logic for the program
      2. Types of programs served best by full procedural logic
        1. "Interactive" programs
        2. "Non-repetitive" programs
  4. Principles of Structured Programming
    1. Applies to any computing platform
    2. "Applied common sense" to controlling the flow of control of logic in a program!
    3. ANY type of program can be written using three types of program logic control
      1. Sequence
        1. Execute statements sequentially
        2. DO … END
      2. Selection
        1. Make a decision
        2. IF (condition true) THEN (do this if true) ELSE (do this if false)
      3. Iteration
        1. Perform tasks repetitively
        2. DO WHILE (condition) …. END
  5. Lab Exercise - Create an interactive inquiry program
    1. Create the display file
      1. Start the program development manager (STRPDM)
      2. Select work with members
      3. Work with file QDDSSRC in library JMYERSDATA
      4. Copy the source file member "SMR211" of type DSPF from file QDDSSRC in library JMYERSDATA to file QDDSSRC in your library.
      5. Change the library name from JMYERSDATA to your library name
      6. Use the source entry utility (SEU) to change the field initialized to all X’s to contain your name.
      7. Create the display file in your library. If the compile ends abnormally, use the WRKSBMJOB command to look at the spool file that was generated by your compile. If you cannot figure it out, please call the instructor.
    2. Create the RPG program
      1. Start the program development manager (STRPDM)
      2. Select work with members
      3. Work with file QRPGSRC in library JMYERSDATA
      4. Copy the source file member "SMR211" of type RPG from file QRPGSRC in library JMYERSDATA to file QRPGSRC in your library.
      5. Change the library name from JMYERSDATA to your library name
      6. Use the source entry utility (SEU) to change the field initialized to all X’s to contain your name.
      7. Create the program in your library. If the compile ends abnormally, use the WRKSBMJOB command to look at the spool file that was generated by your compile. If you cannot figure it out, please call the instructor.
    3. Document the objects you have created
      1. Use the DSPFD command for file SMR211 in YOUR LIBRARY. Use the print screen function to print the first page.
      2. Use the DSPPGM command for program SMR211 in YOUR LIBRARY. Use the print screen function to print the first page.
    4. Run the created program
      1. Use the "CALL" command to "CALL SMR211"
      2. Valid Student ID Codes include 1,2,3, and 4
      3. Use the Print Screen button to print the screens for both a valid and an invalid Student ID
    5. When you are completed,
      1. Staple the 4 pages together and write your name on the printed output
      2. Hand in your work