1 / 22

Free Form RPG

Free Form RPG. A few notes about the use Of Free Form RPG Presented by: Jim Low Arturo Duarte, Jr. Wednesday, September 25, 2002. RPG IV Free Form Discussion Topics. Software Development Improvements Faster Coding Easier to Understand More Built in Functions (BIFs) A Few Less Op Codes

alijah
Télécharger la présentation

Free Form RPG

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. Free Form RPG A few notes about the use Of Free Form RPG Presented by: Jim Low Arturo Duarte, Jr. Wednesday, September 25, 2002 ©Countrywide Home Loans, 2002-2003, All rights reserved

  2. RPG IV Free Form Discussion Topics • Software Development Improvements • Faster Coding • Easier to Understand • More Built in Functions (BIFs) • A Few Less Op Codes • What We Discovered • Information Sources • Significant Op Code Changes • A Look into the Future • Conclusion: Free-Form Advantages • Examples of RPGIII v Free-Form

  3. Software Development Improvements • Faster Coding • Easy to understand • A few more BIFs • A few less Op Codes

  4. Faster Coding • Easy to start and end Free Form • Calculation section start with: /Free (column 7) • Calculation section end with: /End-Free (column 7) • Don’t have to deal with columns • Algebraic Expressions (i.e. X = (Y * Z)/A) • Type like you read – Left to Right • Finally do what you profess – get rid of indicators! (mostly) • Compound IF statements (complex) • Simple IF statements

  5. Easier to Understand • Reading a file • ReadE(EN) filekey filename; • Compared to: • C FileKey ReadE(EN) filename • C Read(EN) filename • Calling a subprocedure • Procname(P1 : P2 : P3 : … : Pn); • Compared to: • CALL ProcName PLIST • CALLP ProcName(P1 : P2 : . . . : Pn) • EVAL RtnValue = ProcName(P1 : P2 : … : Pn)

  6. Easier to Understand (Continued) • Perform date calculations inline or as a conditional • Old way: • C Extrct SomeDate:*M MM • Better way: • MM = %SubDt(SomeDate:*Month); • Even better: • If %SubDt(SomeDate:*Month) = ReportMonth; • Date Conversion: • newDateFormat = %char( %date( oldDateFormat: *YMD): *MDY) ; • Handle in line errors easier • Monitor, On-Error, EndMon Operations for entire blocks of code

  7. A few more BIFs (Built-in-Functions) • %LookUp, %LookUpXX (LT;LE;GT;GE) • %Minutes; %Months (converts argument to duration values for arithmetic operations) • %Occur (Set occurrence of a multiple occurrence data structure) • %SHTDN (determining if the operator has requested shutdown) • %CHAR (Input Value to character conversion – includes numeric, date, time, timestamp, graphic, and UCS-2)

  8. A Few Less Op Codes (Not Allowed in Free-Form Coding) • Move operations • MOVEA; MOVELL; MOVEHL; MOVELH; MOVE • Bit Operations • BITON; BITOFF; TESTB • And others (see iSeries News; Moving Forward with Free-Format RPG)

  9. What we Discovered • An overall 10% improvement in programming speed (based on measurement of time to create new Display File programs for CHL-CHL Refi Application) • Compliance with numeric vs. alpha field handling (i.e. like fields to like fields) • Clarity in programming • A strong need for Best Practices (better yet: Standards) • Think about what is needed first (i.e. define needed variables then develop solution)

  10. What we Discovered (Continued) • A number of similarities between Free-Form and Java. • Anyone can follow the code.

  11. Information Sources • IBM RPG/LE V5R1/V5R2 manuals • iSeries News • Contact with other experts (both in house and external). • Experience with coding (using both traditional and current technology).

  12. Significant Op Code Changes *

  13. Significant Op Code Changes *

  14. Significant Op Code Changes *

  15. A look into the Future • V5R2 Enhancements • Eliminate the need for KLIST/KFLD • Single stroke operands (i.e. +=; -=; /=; etc.) • FLD1 += 1; • ADD 1 FLD1 • EVAL FLD1 = FLD1 + 1 • BitWise BIFs (%BITAND; %BITOR; %BITXOR; etc.) • Complex Data Structures (DIM use at the DS line level; DIM on each sub-field; and DIMs within each sub-field) • Update only selected fields *

  16. A look into the Future (Continued) • V5R2 Enhancements (Continued) • BitWise BIFs (%BITAND; %BITOR; %BITXOR; etc.) • Result = %BitOr(Var.1 : Var.2 : . . . : Var.n); • Complex Data Structures (DIM use at the DS line level; DIM on each sub-field; and DIMs within each sub-field) • D DSName DS 100 DIM(100) • D DSSub1 20 DIM(5) • D DSSub1a 5 DIM(4) Overlay(DSSub1) • Update only selected fields • UPDATE(EN) (Fld1 : Fld2 : Fld3) FileName; *

  17. Conclusion: Free-Form • Is Quicker • Is Easier to Understand • Helps enforcement of good programming practices • Takes advantage of current coding technology • Supports business vision and strategic initiatives. *

  18. Examples of RPGIII v FreeForm *

  19. Examples of RPGIII v FreeForm *

  20. Examples of RPGIII v FreeForm *

  21. Examples of RPGIII v FreeForm *

  22. Examples of FreeForm/CODE400 *

More Related