Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Skills for the RPG Programmer Re-skilling the RPG Programmer Paul Tuohy ComCon 5, Oakton Court Ballybrack Co. Dublin Ireland Phone: +353 1 282 6230 e-Mail: [email protected] Web: www.ComConAdvisor.com © 2001 ComCon WEBCAST SCHEDULE Today’s event will run one-hour long. Here are the expected times for each segment of the webcast: • :00 – :05: Moderator introduces the speaker and discusses the details of the Webcast. • :05- :35: Speaker delivers a PowerPoint presentation on the webcast topic. • :35- :60: Moderator and speaker engage in a Q&A on the topic. You can submit questions to the speaker at any time during the event. Just click on the “Ask a Question” button at the bottom of the presentation screen. TECHNICAL FAQs Here are answers to the most common technical problems users encounter during a webcast: Q: Why can’t I hear the audio part of the webcast? A: Try increasing the volume on your computer. Q: I just entered the webcast and do not see the slide that the speaker is referring to. What should I do? A: The slides are constantly be pushed to your screen. You’ll should refresh (hit F5) to view the latest slide. If your question is still not answered, please click the “Ask a Question” button at the bottom of your screen and submit your problem. A technical support person will respond immediately. You can also visit the Broadcast Help page for more information or to test your browser compatibility: http://help.yahoo.com/help/bcst/ Skills for the RPG Programmer Re-skilling the RPG Programmer Paul Tuohy ComCon 5, Oakton Court Ballybrack Co. Dublin Ireland Phone: +353 1 282 6230 e-Mail: [email protected] Web: www.ComConAdvisor.com © 2001 ComCon Agenda Skills for what? Why do you need to re-skill? What has changed? What Are The First Steps? Know your system. Know your database. Use The Right Tools for the Job. Get to Grips with RPG IV and ILE. Find Out about Event-Driven Programming. Learn the basics of HTML and Javascript. Then What? HTML, Javascript and CGI. Visualage RPG Java WebSphere whatever. © 2001 ComCon The times they are a changing....... Java WebSphere ILE RPG IV WebFacing HTML/CGI © 2001 ComCon Premise You are not using third-party tools There are many Great third-party tools out there. I will mention some later. Maybe you should be using one of them!!!! All You Have is WebSphere Development Toolset (V5R1) or WebSphere Development Studio Client (V5R1/V5R2)! Application Development Toolset (ADTS). WebSphere Development Tools for iSeries. –Code/400 (Editor, Designer, Project Manager). –Distributed Debugger – WebSphere Studio – WebFacing Tool –VisualAge for RPG. VisualAge for Java ALL of the compilers for OS/400 –RPG, Cobol, C, Java, etc. © 2001 ComCon Where to Start? There are a few things you need to look into before you enhance your programming skills. Become familiar with the IFS (Integrated File System) Become familiar with iSeries Navigator (Operations Navigator) –Especially the IFS and Database. Grasp the basics of SQL –You can do this from iSeries Navigator without Interactive SQL. –SQL is slowly(?) replacing DDS. Find out about triggers. Find out about referential integrity. © 2001 ComCon Use iSeries Navigator iSeries Navigator is the GUI interface for OS/400 Navigator is getting the development dollars – Green Screen is not! Navigator is part of the “free” portion of iSeries Access. Have a look at Basic Operations to get a feel for how it works. Become familiar with the IFS (Integrated File System) Become familiar with the Databases. © 2001 ComCon Explore the IFS iSeries supports multiple file systems – not just QSYS! Root - PC style QOpenSys - Unix style QDLS - Shared Folders QSYS.LIB - Traditional OS/400 QOPT - Optical Storage QNTC - Windows NT Servers And more…… © 2001 ComCon Explore Databases This is the new interface for Database functions Have a look at how tables/views and indexes are created © 2001 ComCon Creating a Table This is not DDS! Navigator offers a “friendly” interface to SQL’s Data Definition Language (DDL) © 2001 ComCon Database Navigator Database Navigator will give you a diagram of your Database! Just a little bit easier then DSPFD and DSPFFD! © 2001 ComCon SQL Get to grips with SQL. It is becoming the standard for maintaining the database. SQL is being developed - DDS is not. © 2001 ComCon Triggers and Referential Integrity Triggers Programs that are called when a row (record) is inserted, updated or deleted. An excellent means of applying business rules. Referential Integrity Define relationships between tables (physical files) e.g. You cannot delete a customer if they have outstanding invoices When you delete the Order Header record, automatically delete all corresponding Order Details. © 2001 ComCon The Choices Green Screen Although everything is heading towards GUI, there is still a place for green screen within applications. Not everything lends itself to point and click. GUI Application Good old Client Server! Browser-based The interface is in a browser. Fast becoming the most popular. Easiest to distribute to the Internet. © 2001 ComCon The Right Tools Get with the right tools. SEU/SDA/RLU are NOT up to the job. Use of Code/400 can increase productivity by 20% to 40%!!! © 2001 ComCon Code/400 Code/400 is A customizable editor Reference manual as help Navigator Verifier Much, much more © 2001 ComCon Code/400 Editor © 2001 ComCon Code/400 Verifier © 2001 ComCon Code/400 Help © 2001 ComCon Code/400 Navigator © 2001 ComCon RPG IV Get up to speed with RPG IV If you are still using RPG III - STOP NOW You will start to see gains from RPG IV within a very short period of time. /FREE D_PgmTxt = *Blank; D_Proc = SDSProcName; D_PgmTxt = 'Work with'; If Show_Paid and Show_Unpaid; D_PgmTxt = %trim(D_PgmTxt) + ' Paid and Unpaid'; EndIf; If Show_Paid and Not Show_Unpaid; D_PgmTxt = %trim(D_PgmTxt) + ' Paid'; EndIf; /END-FREE © 2001 ComCon Getting there…… Getting there is easy! CVTRPGSRC IBM supplied conversion tool. Performs basic syntax conversion. Convert, Compile, Relax. Third-party Option If you want more than basic syntax conversion. If you want code re-engineered to use new features. Check out the RPGToolBox from Linoma Software (www.linoma.com) © 2001 ComCon RPG IV Highlights Here you have it -- the brand new RPG! 10-character external names (files, format and field names). Allow mixed case. Allow blank lines. Introduction of new Definition (D) Specification. Elimination of Extension (E) and Line Counter (L) Specifications and the practical elimination of Input (I) Specifications. Re-definition of the Header (H), File (F) and Calculation (C) Specifications. More powerful array definition and processing. Prefixing externally defined files. Date processing and manipulation. Named Indicators Introduction of new data types, especially integers and pointers. Introduction of Built-in Functions (e.g. %SUBST). Introduction of Subprocedures and other ILE-related features. Integration with Java. And, of course, free format. But perhaps the most important change is that the re-structuring has made RPG even easier to change in the future © 2001 ComCon Subprocedures Subprocedures are the biggest change to RPG - EVER! They provide a means of encapsulation. DayNumber = DayofWeek(InputDate); ErrInds = ValidCustomer(CustomerData); If (GetCustomerDept(Customer)) = 'A01'; © 2001 ComCon Subprocedures This is what the code looks like....... P DayOfWeek D D InpDate B PI D ASaturday D WorkDay S S 1P 0 D D Inz(D'02/13/99') 1P 0 /FREE WorkDay = %Rem(%Diff(InpDate : ASaturday : *D): 7); If WorkDay < 1; WorkDay = WorkDay + 7; EndIf; Return WorkDay; /END-FREE P DayOfWeek E © 2001 ComCon ILE Subprocedures lead to Service Programs. You start to look at program design in a different way. Procedure Procedure Procedure *Module Procedure Procedure Procedure Procedure *Module *Module Procedure Procedure Procedure *Pgm *Module *SrvPgm © 2001 ComCon Clients are Event Driven! Client Applications are event driven. Client Applications can be written in: Java Visual Basic C/C++ Any PC programming language Even RPG!!!! For VisualAge RPG you need to learn GUI Design Event Driven But it is still RPG © 2001 ComCon HTML Learn the basics of HTML Easy to learn Lots of good books. I liked "HTML for the World Wide Web" by Elizabeth Castro ISBN 0-201-35493-4 Code/400 is a HTML editor. <TR><td ALIGN=CENTER VALIGN=TOP WIDTH="404" HEIGHT="186"><font face="Arial">To contact us: <p>Phone: +353 1 282 6230<br> Fax: +353 1 282 6230<br> Email:<a href="mailto:[email protected]"> [email protected]</a> <p>5, Oakton Court<br> Ballybrack<br> Co. Dublin<br> Ireland <p>© ComCon Computer Consultants 2002</font> </td></TR> © 2001 ComCon What is CGI ? CGI stands for 'Common Gateway Interface' It supports the ability to dynamically build Web pages –It dictates format of the data stream for requests and responses A standard for communicating between a browser and an HTTP Server Server is configured to pass specific URLs to CGI scripts Not simply to respond with a pre-built Web page In our case the "script" will be an RPG IV program The program generates HTML and passes it to the server Which then sends it out for display as it would any other page CGI programming on the AS/400 is supported by RPG IV (ILE RPG) Java – Plus ILE COBOL, ILE C, ILE C++, Rexx and Perl © 2001 ComCon Sample of a CGI Web Page © 2001 ComCon Sample of Code for Previous Page This writes one "detail" line The HTML code is constructed in the RPG Program. WebOut = NewLine + '<tr align=right>' + '<td>' + ProdCd +'</td>' + '<td align=left>' + ProdDs +'</td>' + '<td>' + CatCod + '</td>' + '<td>' + %Char(LndCst) + '</td>' + '<td>' + %Char(SellPr) + '</td>' + '<td>' + PrLOrdA + '</td>' + '<td>' + NoDaysA +'</td></tr>' WriteWebData(WebData : WebDataLen : APIError) © 2001 ComCon "Native" CGI problems The APIs are not as simple as one would like And the documentation is less than wonderful Generating HTML directly in the program reduces flexibility To change the text, one must change the program –And it is much more difficult to use HTML editors to design the pages It would be nice to have something like DDS That way only the variable content is handled by the program –But writing such a generalized routine to process HTML text and perform text substitution is not a trivial task IBM has an answer And it is FREE !! The CGIDEV2 Library Available for download at www-922.ibm.com © 2001 ComCon Sample from CGIDEV WIth CGIDEV, the HTML is kept separate from (or external to) the RPG Program. : : /$TableRow <TR ALIGN=RIGHT> <TD /%ProdCd%/</TD> <TD ALIGN=LEFT>/%ProdDs%/</TD> <TD>/%CatCod%/</TD> <TD>/%LndCst%/</TD> <TD>/%SellPr%/</TD> <TD>/%PrlOrdA%/</TD> <TD>/%NoDaysA%/</TD> </TR> : : © 2001 ComCon Code from Previous Sample Coding is MUCH easier with CGIDEV // Load substitution variables UpdHTMLVar('ProdCd':ProdCd) UpdHTMLVar('ProdDs':ProdDs) UpdHTMLVar('CatCod':CatCod) UpdHTMLVar('LndCst':%Char(LndCst)) UpdHTMLVar('SellPr':%Char(SellPr)) UpdHTMLVar('PrlOrdA':PrlOrdA) UpdHTMLVar('NoDaysA':NoDaysA) // And add row to table WrtSection('TableRow') © 2001 ComCon So Far...... If you learn RPG IV Some ILE Some HTML You can be on the Web in No Time! Getting to the Web is Easy!!!!! © 2001 ComCon Javascript Extend those HTML capabilities Javascript is NOT full blown Java by any means. <HTML><HEAD><TITLE>Quote of the Day</TITLE> </HEAD><BODY><DIV ALIGN=CENTER><H1>Quote of the Day</H1> <HR><FONT COLOR="navy" SIZE="5"> <SCRIPT> <!-var quotes = new Array() quotes[0] = "Every time history repeats itself the price goes... quotes[1] = "The moment you think you understand a great work ... .. .. .. .. quotes[9] = "So little done, so much to do.... document.write(quotes[Math.round(Math.random()*9)]) // --> </SCRIPT></FONT></DIV></BODY></HTML> © 2001 ComCon WebFacing Time:8:05 date:Oct 22,2000 enter customer number:_____ RPG Program DOWProto P DayOfWeek B D PI D/Copy 1P0 D WorkDate D D AnySunday S D WorkNum D WorkDay S S D INZ(D'1995-04-02') 7 0 1P 0 C WorkDate SubDur AnySunday WorkNum:*D C WorkNum Div 7 WorkNum C MvR WorkDay C If WorkDay < 1 C Return WorkDay + 7 C Else C Return WorkDay C EndIf P DayOfWeek E Workstation manager ? Converts DDS to Servlets and JSPs There is NO change to the RPG Programs © 2001 ComCon WebSphere Studio © 2001 ComCon WebSphere Application Server Servlets Java Server Pages (JSPs) Enterprise Java Beans (EJBs) Web Browser HTML Application Server HTTP server Any Client, Any Browser Servlet Engine EJB Client TCP /IP Admin Console EJB Container Administrative Server © 2001 ComCon JDBC RPG Cobol Etc. Data base And then there is Java Get to grips with OO.... it is very different. A good grounding in RPG IV and ILE makes it easier to understand. Set Name & Address Set Balance Set Balance Get Balance Get Phone Get Address Set Balance Get Balance Get Address A Customer © 2001 ComCon Get Name Java Java is an OO language © 2001 ComCon Java Code in Code/400 © 2001 ComCon A Plan of Action Must Do....... Should Do....... IFS Code/400 iSeries Navigator SQL RPG IV and ILE HTML and CGI And then Any of....... WebFacing VisualAge for RPG OO and Java WebSphere Studio, Javascript and JSPs Triggers and RI © 2001 ComCon The Learning Curve Times are opinion based on the experience of many. "Practice" is to a level of proficiency as opposed to expertise. T he Learning Curve Code/400 RPG IV ILE Basic CGI CGIDEV T opics Course Self T each Basic W AS Practice Basic W ebfacing W ebsphere Studio OO Java 0 10 20 30 40 50 W ork Days © 2001 ComCon 60 70 80 90 100 How Long Will It Take? Pick the Route Carefully!!!!!! Course Code/400 RPG IV ILE Basic CGI CGIDEV Basic WAS Webfacing Studio OO Java Self Teach Practice 2 5 7 4 2 1 2 3 2 2 3 8 10 10 5 5 10 5 5 10 20 10 80 25 15 20 15 10 100 30 © 2001 ComCon The Choice is Yours!! Lay the foundations IFS, SQL, iSeries Navigator, Triggers, Referential Integrity. Take the first step Code/400 RPG IV and ILE HTML CGI Jump VisualAge for RPG WebFacing OO and Java © 2001 ComCon Some References "Who Knew You Could Do That With RPG IV?" IBM Red Book SG24-5402 at www.redbooks.ibm.com "Re-Engineering RPG Legacy Applications" By Paul Tuohy ISBN 1-58347-006-9 at mc-store.com "HTML for the World Wide Web" By Elizabeth Castro ISBN 0-201-35493-4 "e-RPG - Building AS/400 Web Applications with RPG" By Brad Stone ISBN 158347-008-5 at mc-store.com "Java for RPG Programmers" By George Farr and Phil Coulthard ISBN 1-889671-23-1 at mc-store.com The CGIDEV2 web site www-992.ibm.com The RPG Toolbox www.linoma.com © 2001 ComCon Questions? Submit your questions now by clicking on the “Ask A Question” button in the left corner of your presentation screen. Paul will answer your questions shortly after the broadcast.