Figure 4: Here's the HTML code for CGIDEV2/DEMOHTML MBR(GETCUS2).

The markers /$top, /$tabrow, and /$bottom are not HTML tags, but markers for the CGIDEV2 tool to use to identify sections of the HTML code. The variable /%cname%/ is also not HTML; it's only a marker that the CGI program replaces with real data. The CGI program mixes the HTML code and the live data from the database into a text string in a buffer that is then sent to the remote user. In this case, it builds the Web page displayed in Figure 5.

http://www.mcpressonline.com/articles/images/2002/My%20First%20Web%20Page%20with%20RPG%20and%20CGIDEV2--V4--07010501.png

Figure 5: Here's your second Web page.

This is just the simplest of examples, showing you how to code your own CGI programs using RPGLE and CGIDEV2. IBM provides plenty of examples to help you expand into increasingly sophisticated Web pages.

That Was Then, and This Is Now

No RPG programmer has any excuse for not developing effective and exciting browser-based applications. Best of all, you can easily adapt existing program logic from your current applications to work with Web-based applications.

Just as an added bonus, CGIDEV2 shows off the real power of ILE programming by delivering this great and complex tool all neatly bundled inside ILE service programs. I may have disliked the clunky interface of the original CGIDEV product, but that was then, and this is now! I love the slick new interface provided by CGIDEV2.

Kevin Forsythe is the author of the new book SQL for eServer i5 and iSeries. He has over 18 years of experience working with the iSeries platform and its predecessors. He has been a member of the DMC team for the past nine years. Kevin's primary responsibility is providing iSeries education, but he also provides customers with project management, system design, analysis, and technical construction. In addition to his technical skills (RPG IV, CL, OS/400, SQL, FTP, Query, VB, Net.Data), Kevin possesses the ability to communicate new and complex concepts to his students. He has been the primary instructor for DMC's iSeries-based AS/Credentials training courses since 1997 and has authored courses such as Advanced ILE, SQL, Embedded SQL, Operations Navigator, and Intro to WebSphere Studio. An award-winning speaker, he has spoken at every COMMON Conference since the spring of 2000.


Gina Whitney
About the Author:

Gina Whitney is a staff software engineer at IBM in SQL development for DB2 for i5/OS. She is responsible for the SQL precompilers. Gina is located in Rochester, Minnesota and can be reached at whitneyg@us.ibm.com.

Read More >>
Last Updated on Tuesday, 05 June 2007 18:00
 
MC Press Web Site Staff
** This thread discusses the Content article: Best of TechTips: Build Web Pages with RPG and CGIDEV20
Guest.Visitor
Most shops were I work still use RPG III because of it simplicity against RPG IV. That\'ve keep me from honing my skills in RPG IV
toms@daprex.com
Using CRTBNDRPG, the compile listing shows the message "Errors were found during the binding step. See the job log for more information." Looking in the joblog I see messages like "Definition not found for symbol \'GETHTML\'." I get the same error for UPDHTMLVAR & WRTSECTION. Am I doing something wrong here?
toms@daprex.com
1. Remove the H-spec from GETCUS (otherwise step 2 will fail). 2. Use CRTRPGMOD (PDM opt. #15) to compile GETCUS. 3. Use CRTPGM to bind module GETCUS with service program CGISRVPGM2 into program GETCUS. Use the BNDSRVPGM parameter.
AppDesigner
But may I take the opportunity to STRONGLY SUGGEST that your shop May I STRONGLY suggest as a first step, converting to the RPGIV syntax. There are SO SO MANY MULTITUDES of juicy things that make programming MUCH simpler. Learn a little, get back a LOT. More space for meaningful field names, qualified data structures, LIKEDS, and wow! free format with indentation, and way more! And though there\'s a bit of a learning curve investment for using service programs, there\'s a pretty quick return on the investment there, it\'s really worth it!
David Abramowitz
There really is no excuse for not using RPG IV.
    [*>The CVTRPGSRC command makes conversion easy, simple and pain-free. [*>You can use as much RPG III in your RPG IV program as you like. [*>It is harmless - Conversion to RPG IV will not hurt your programs or your systems. [*>The benefits have already been outlined a thousand times in these fora. All you need to do is take the first step.[/list> Dave
Guest.Visitor
RPG IV has been around since 1995. When will you get on board? You don\'t need to use ILE features. Just the date/time/string opcodes are worth it! Chris
Ralph Daugherty
That\'s true, Dave and Chris, but questioner should at least be aware we\'re in a thread about a service program which does require ILE. rd
Please login to make comments.
User Rating: / 2
PoorBest 

Related Articles:

WHITE PAPERS

The following White Papers can be found at the MC White Paper Center

 

 


   MC-STORE.COM