Reputation: 195
I am looking at an RPG program. there are some subroutines like this: are there any tools which would create this as a procedure, that could be used in separate process?
C Eval FinQty# = 0
C Eval OdCom# = OhCom#
C Eval OdOrd# = OhOrd#
C OdKey Setll OeOrd1
C OdKey Reade OeOrd1
C Dow %eof = *off
*
C If OdPrt# = OdAls# and
c %subst(odprt#:1:3) <> 'FRT'
C Eval FinQty# += OdQty#
C Endif
*
C OdKey Reade OeOrd1
C Enddo
*
Upvotes: 2
Views: 290
Reputation: 7648
Yes, there are tools. I would not use them.
Arguably, the key benefit to subprocedures are local variables and a parameterised interface. No automated tool is going to be able to tease out the interface, and figuring out which global variables should be made into local variables is a daunting task.
For my money then, all an automated tool will do is to convert the syntax from EXSR to CALLP. The 'subprocedure' is still using global variables and the interface is still hidden from the programmer. What's the point?
Upvotes: 7
Reputation: 23783
Yes
I'm particularly fond of Linoma's RPG Wizard http://www.linomasoftware.com/products/rpgtoolbox/rpgwizard
Arcad has another tool, but it has more functionality and is more $$$. http://www.arcadsoftware.com/products/arcad-transformer-ibm-i-refactoring-tools/
Note that Linoma will convert the syntax from internal subroutine to internal procedure; but it'd be a manual process to move the procedure externally.
Whereas I believe Arcard's toolset can build an external procedure.
Upvotes: 1