© 2001 comcon skills for the rpg programmer re-skilling the rpg programmer

50
© 2001 ComCon Skills for the RPG Programmer ComCon 5, Oakton Court Ballybrack Co. Dublin Ireland Re-skilling the RPG Programmer Phone: +353 1 282 6230 e-Mail: [email protected] Web: www.ComConAdvisor.com Paul Tuoh

Upload: edwin-owens

Post on 24-Dec-2015

249 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: © 2001 ComCon Skills for the RPG Programmer Re-skilling the RPG Programmer

© 2001 ComCon

Skills for the RPG Programmer

ComCon5, Oakton CourtBallybrackCo. DublinIreland

Re-skilling the RPG Programmer

Phone: +353 1 282 6230e-Mail: [email protected]: www.ComConAdvisor.com

Paul Tuohy

Page 2: © 2001 ComCon Skills for the RPG Programmer Re-skilling the RPG Programmer

WEBCAST SCHEDULEToday’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.

Page 3: © 2001 ComCon Skills for the RPG Programmer Re-skilling the RPG Programmer

TECHNICAL FAQsHere 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/

 

Page 4: © 2001 ComCon Skills for the RPG Programmer Re-skilling the RPG Programmer

© 2001 ComCon

Skills for the RPG Programmer

ComCon5, Oakton CourtBallybrackCo. DublinIreland

Re-skilling the RPG Programmer

Phone: +353 1 282 6230e-Mail: [email protected]: www.ComConAdvisor.com

Paul Tuohy

Page 5: © 2001 ComCon Skills for the RPG Programmer Re-skilling the RPG Programmer

© 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.

Page 6: © 2001 ComCon Skills for the RPG Programmer Re-skilling the RPG Programmer

© 2001 ComCon

The times they are a changing.......

Java

WebSphereILE WebFacing

RPG IV HTML/CGI

Page 7: © 2001 ComCon Skills for the RPG Programmer Re-skilling the RPG Programmer

© 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.

Page 8: © 2001 ComCon Skills for the RPG Programmer Re-skilling the RPG Programmer

© 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.

Page 9: © 2001 ComCon Skills for the RPG Programmer Re-skilling the RPG Programmer

© 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.

Page 10: © 2001 ComCon Skills for the RPG Programmer Re-skilling the RPG Programmer

© 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……

Page 11: © 2001 ComCon Skills for the RPG Programmer Re-skilling the RPG Programmer

© 2001 ComCon

Explore Databases

This is the new interface for Database functions Have a look at how tables/views and indexes are created

Page 12: © 2001 ComCon Skills for the RPG Programmer Re-skilling the RPG Programmer

© 2001 ComCon

Creating a Table

This is not DDS! Navigator offers a “friendly” interface to SQL’s Data Definition Language (DDL)

Page 13: © 2001 ComCon Skills for the RPG Programmer Re-skilling the RPG Programmer

© 2001 ComCon

Database Navigator

Database Navigator will give you a diagram of your Database! Just a little bit easier then DSPFD and DSPFFD!

Page 14: © 2001 ComCon Skills for the RPG Programmer Re-skilling the RPG Programmer

© 2001 ComCon

SQL

Get to grips with SQL. It is becoming the standard for maintaining the database. SQL is being developed - DDS is not.

Page 15: © 2001 ComCon Skills for the RPG Programmer Re-skilling the RPG Programmer

© 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 invoicesWhen you delete the Order Header record, automatically delete all corresponding Order Details.

Page 16: © 2001 ComCon Skills for the RPG Programmer Re-skilling the RPG Programmer

© 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.

Page 17: © 2001 ComCon Skills for the RPG Programmer Re-skilling the RPG Programmer

© 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%!!!

Page 18: © 2001 ComCon Skills for the RPG Programmer Re-skilling the RPG Programmer

© 2001 ComCon

Code/400

Code/400 is A customizable editor Reference manual as help Navigator Verifier Much, much more

Page 19: © 2001 ComCon Skills for the RPG Programmer Re-skilling the RPG Programmer

© 2001 ComCon

Code/400 Editor

Page 20: © 2001 ComCon Skills for the RPG Programmer Re-skilling the RPG Programmer

© 2001 ComCon

Code/400 Verifier

Page 21: © 2001 ComCon Skills for the RPG Programmer Re-skilling the RPG Programmer

© 2001 ComCon

Code/400 Help

Page 22: © 2001 ComCon Skills for the RPG Programmer Re-skilling the RPG Programmer

© 2001 ComCon

Code/400 Navigator

Page 23: © 2001 ComCon Skills for the RPG Programmer Re-skilling the RPG Programmer

© 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

Page 24: © 2001 ComCon Skills for the RPG Programmer Re-skilling the RPG Programmer

© 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)

Page 25: © 2001 ComCon Skills for the RPG Programmer Re-skilling the RPG Programmer

© 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

Page 26: © 2001 ComCon Skills for the RPG Programmer Re-skilling the RPG Programmer

© 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';

Page 27: © 2001 ComCon Skills for the RPG Programmer Re-skilling the RPG Programmer

© 2001 ComCon

Subprocedures

This is what the code looks like.......

P DayOfWeek B D PI 1P 0 D InpDate D

D ASaturday S D Inz(D'02/13/99') D WorkDay S 1P 0

/FREE

WorkDay = %Rem(%Diff(InpDate : ASaturday : *D): 7);

If WorkDay < 1; WorkDay = WorkDay + 7; EndIf;

Return WorkDay;

/END-FREE P DayOfWeek E

Page 28: © 2001 ComCon Skills for the RPG Programmer Re-skilling the RPG Programmer

© 2001 ComCon

ILE

Subprocedures lead to Service Programs.

You start to look at program design in a different way.

Procedure

Procedure

Procedure

Procedure

Procedure

Procedure

*Module

*Module

*SrvPgm

Procedure

Procedure

*Module

Procedure

Procedure

*Module

*Pgm

Page 29: © 2001 ComCon Skills for the RPG Programmer Re-skilling the RPG Programmer

© 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

Page 30: © 2001 ComCon Skills for the RPG Programmer Re-skilling the RPG Programmer

© 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>&copy; ComCon Computer Consultants 2002</font></td></TR>

Page 31: © 2001 ComCon Skills for the RPG Programmer Re-skilling the RPG Programmer

© 2001 ComCon

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

What is CGI ?

Page 32: © 2001 ComCon Skills for the RPG Programmer Re-skilling the RPG Programmer

© 2001 ComCon

Sample of a CGI Web Page

Page 33: © 2001 ComCon Skills for the RPG Programmer Re-skilling the RPG Programmer

© 2001 ComCon

Sample of Code for Previous Page

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)

This writes one "detail" line The HTML code is constructed in the RPG Program.

Page 34: © 2001 ComCon Skills for the RPG Programmer Re-skilling the RPG Programmer

© 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

Page 35: © 2001 ComCon Skills for the RPG Programmer Re-skilling the RPG Programmer

© 2001 ComCon

Sample from CGIDEV

: : /$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>: :

WIth CGIDEV, the HTML is kept separate from (or external to) the RPG Program.

Page 36: © 2001 ComCon Skills for the RPG Programmer Re-skilling the RPG Programmer

© 2001 ComCon

Code from Previous Sample

// 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')

Coding is MUCH easier with CGIDEV

Page 37: © 2001 ComCon Skills for the RPG Programmer Re-skilling the RPG Programmer

© 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!!!!!

Page 38: © 2001 ComCon Skills for the RPG Programmer Re-skilling the RPG Programmer

© 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>

Page 39: © 2001 ComCon Skills for the RPG Programmer Re-skilling the RPG Programmer

© 2001 ComCon

WebFacing

DOWProto

P DayOfWeek B D PI D/Copy 1P0 D WorkDate D D AnySunday S D INZ(D'1995-04-02')

D WorkNum S 7 0

D WorkDay S 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

RPG Programenter customer number:_____

Time:8:05 date:Oct 22,2000

?

5250

Web

5250

to W

eb

conv

ersi

onWorkstationmanager

Converts DDS to Servlets and JSPsThere is NO change to the RPG Programs

Page 40: © 2001 ComCon Skills for the RPG Programmer Re-skilling the RPG Programmer

© 2001 ComCon

WebSphere Studio

Page 41: © 2001 ComCon Skills for the RPG Programmer Re-skilling the RPG Programmer

© 2001 ComCon

WebSphere Application Server

TCP/IP

HTTP server

Servlet EngineJDBCRPGCobolEtc.

Administrative Server

Database

Any Client, Any Browser

HTMLWeb

Browser

Admin

Console

EJB Container

Application Server

EJB Client

Servlets Java Server Pages (JSPs) Enterprise Java Beans (EJBs)

Page 42: © 2001 ComCon Skills for the RPG Programmer Re-skilling the RPG Programmer

© 2001 ComCon

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.

Get Phone

Get Address

Set Balance

Get Balance

Get Name

Get Balance

Get Address

Set Balance

Set Name & Address

Set Balance

A Customer

Page 43: © 2001 ComCon Skills for the RPG Programmer Re-skilling the RPG Programmer

© 2001 ComCon

Java

Java is an OO language

Page 44: © 2001 ComCon Skills for the RPG Programmer Re-skilling the RPG Programmer

© 2001 ComCon

Java Code in Code/400

Page 45: © 2001 ComCon Skills for the RPG Programmer Re-skilling the RPG Programmer

© 2001 ComCon

A Plan of Action

IFS

iSeries Navigator

SQL

Triggers and RI

Must Do....... Should Do....... And then Any of.......

Code/400

RPG IV and ILE

HTML and CGI

WebFacing

VisualAge for RPG

OO and Java

WebSphere Studio,

Javascript and JSPs

Page 46: © 2001 ComCon Skills for the RPG Programmer Re-skilling the RPG Programmer

© 2001 ComCon

The Learning Curve

0 10 20 30 40 50 60 70 80 90 100

Work Days

Code/400

RPG IV

ILE

Basic CGI

CGIDEV

Basic WAS

Basic Webfacing

Websphere Studio

OO

Java

Topics

The Learning Curve

CourseSelf Teach

Practice

Times are opinion based on the experience of many. "Practice" is to a level of proficiency as opposed to expertise.

Page 47: © 2001 ComCon Skills for the RPG Programmer Re-skilling the RPG Programmer

© 2001 ComCon

How Long Will It Take?

Pick the Route Carefully!!!!!!

Course Self Teach Practice

Code/400 2 5 7

RPG IV 4 10 10

ILE 2 10 80

Basic CGI 1 5 25

CGIDEV 2 5 15

Basic WAS 3 10 20

Webfacing 2 5 15

Studio 2 5 10

OO 3 10 100

Java 8 20 30

Page 48: © 2001 ComCon Skills for the RPG Programmer Re-skilling the RPG Programmer

© 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

Page 49: © 2001 ComCon Skills for the RPG Programmer Re-skilling the RPG Programmer

© 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

Page 50: © 2001 ComCon Skills for the RPG Programmer Re-skilling the RPG Programmer

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.