While mainframe COBOL and iSeries COBOL are similar, your developers will have a learning curve moving from and environment where all file processing including defining, sorting and setting up keys is handled in the COBOL program on the Mainframe, on the iSeries, the world is a little different. Files and indexes (Logical files) are defined externally and are only referenced by name in the iSeries world. In addition, using the latest techniques of RPG will move the staff towards separation of business logic from normal program operations. Using Modules/prototypes and service programs will further define the environment.
As an example:
D/Copy CustInfoDS D Rc S 10I 0 ... C Eval Rc = GetCustomerInfo(CustNum:CustInfoDs) C If Rc < 0 C Eval ErrData = %Editc(CustNum:'Z') C Eval Rc = SndMyMsg("INVCUSTNUM":ErrData) C Iter C Else C Eval Rc = CalcEOMAmounts(CustNum:CustInfoDs) C If Rc < 0 C Eval ErrData = %Editc(CustNum:'Z') C Eval Rc = SndMyMsg("CALCEOM":ErrData) C Iter C Else C Eval Rc = UpdCustomerInfo(CustNum:CustInfoDs) C If Rc < 0 C Eval ErrData = %Editc(CustNum:'Z') C Eval Rc = SndMyMsg("CUSTUPD":ErrData) C Iter C Endif C Endif C Endif
This would assume that standard modules for retrieval, calculation and updating of customer information would return a -1 for failure and a standard error routine to send the message to the user or joblog for batch processes. In COBOL, this would likely be hundreds of lines of code for file definition, retrieval and error message handling. The simplification of coding and maintenance should be apparent. Separate business logic from physical data logic and user interfaces allows the routines to be quickly adapted to different applications and environments.
================================== MORE INFORMATION ON THIS TOPIC ==================================
The Best Web Links: tips, tutorials and more.
Ask your programming questions--or help out your peers by answering them--in our live discussion forums.
Ask the Experts yourself: Our application development gurus are waiting to answer your programming questions.
This was first published in December 2003