Free Form RPG - PowerPoint PPT Presentation

1 / 23
About This Presentation
Title:

Free Form RPG

Description:

Free directives go at postion 7 or 1st. postion to the right of the ... SETOFF, SETON, SUB, SUBST, SUBST(P), TAG, TESTB, TESTN, TIME, WHENxx, Z-ADD, Z-SUB ... – PowerPoint PPT presentation

Number of Views:748
Avg rating:3.0/5.0
Slides: 24
Provided by: david2762
Category:
Tags: rpg | form | free | seton

less

Transcript and Presenter's Notes

Title: Free Form RPG


1
Free Form RPG
2
Why Free Form? Cleaner More Structured Easier to
read Easier to code Indented Source Code Easier
to modify and maintain
3
Must be running at least Version 5 Release 1 or
later
4
Free directives go at postion 7 or 1st postion
to the right of the standard spec type /Free
and /End-Free code without a semicolon d
c /Free
/End-Free
5
All variables must be defined in the D
Specs before c move
12345 Cust 5 now d Cust s
5 inz(12345)
6
Op-Codes not supported ADD, ANDxx, CALL, CASxx,
COMPxx, CABxx, CAT, DEFINE, DIV, DOUxx, DOWxx,
GOTO, IFxx, MOVE, MOVEL, MOVEA, MOVE(P), MULT,
MVR, Orxx, PARM, PLIST, SCAN, SETOFF, SETON,
SUB, SUBST, SUBST(P), TAG, TESTB, TESTN, TIME,
WHENxx, Z-ADD, Z-SUB some are replaced with
BIFs (built-in-function)
7
Changed Op-Codes ADD is now SUB
is now - DIV is now / MULT is
now CAT is now
8
MOVE and MOVEL was move Dec Char now
ds d Char 4
d Dec
4 0 overlay(Char) or Char
CHAR(Dec) Char EDITC(DecZ)
9
was move Char Dec now Dec
UNS(Char) (unsigned) also BIFs DEC, FLOAT,
INT valid statement Dec INT(1234.56)
10
EVAL(optional) was c eval
C C 1 now C C 1 eval must be
used with extender eval(H) C B / A
11
CALL was c call MyPgm
parm
MyParm now MyPgm(MyParm) or callp
MyPgm(MyParm) (must prototype)
12
Prototypes Program Call d CustSrch pr
extpgm(CUSTSRCH) d Cust 5
const now call CustSrch(Cust) or callp
CustSrch(Cust) with 2 parms callp
CustSrch(CustCustName)
13
Entry Prototype replaces Entry before c
entry plist

parm Cust now d Main
pr extpgm(MyPgm) d
5
d Main pi
d Cust
5

14
All statements inside the /Free /End-Free tags
are ended with a semicolon Cust
12345 A statement can continue over several
lines if Cust lt gt 00000 and Cust lt
gt 99999 and Cust lt gt
15
Klist not supported in /Free Klist now must be in
C Spec c Key Klist c KFld
Cust c KFld Inv /Free or

16
new in V5 R2 BIF KDS d Key ds
likerec (MyFile Key) chain KDS(Key)
MyFile multiple key fields chain KDS(Key2)
MyFile
17
Copy Books /copy bring code in as fixed
format must use /Free and /End-Free in the Copy
Book source
18
Indention You may now indent your code for
readability
Item 12345 chain KDS(Key) InvnMst If
FOUND select when
Category 1 exsr
LoadCat1 when Category 2
exsr LoadCat2 endsl
endif
19
Start out mixing Fixed Format and Free Format
this is valid c
move Date Today c
USA move Today AlphaDate
/Free dow inkc off do some
stuff enddo inlr on
return /End-Free
or
20
/Free do loop exsr SRFixed
enddo inlr on /End-Free c SRFixed
begsr c movel
This is to Start Var c
endsr
21
C Function h BndDir(QC2LE)
DftActGrp(NO) d CharToFloat pr
extpgm(ATOF) d Char 15
const d Dec
15 0 const now
call CharToFloat(CharDec) or callp
CharToFloat(CharDec)
22
Web Sites http//www.ebisynetics.com/t _RPGtoFree
.htm http//www.linomasoftware.com/products /rpgt
oolbox/why-free.html http//publib.boulder.ibm.co
m/iseries /v5r1/ic2924/books/c0925073.pdf http//
ringsurf.com/netring?ringas400 webringactioninf
o
23
Http//groups.yahoo.com search for
AS/400 http//groups.yahoo.com/group/RPGIV/ http
//groups.yahoo.com/group/eZ400/ http//home.allte
l.net/craigru http//www.scottklement.com http//w
ww.partner400.com
Write a Comment
User Comments (0)
About PowerShow.com