Leveraging Legacy Code With ProGen WebSmart

Next Steps
Download a Free Trial
Talk to a Product Specialist:
 630-986-0800
Schedule a Live Web Demo
Overview
Features
Get Technical Support
 
Product Info
WebSmart Home
New Features
Why Choose WebSmart
Installation Instructions
Getting Started
Product Sheet
RPG/DDS Conversion Tool
Professional Services
Product Editions
WebSmart ILE
WebSmart PHP
WebSmart Showcase
Customer Gallery
Customer Interviews
Example Code
Video demo
Product Ad
Proven Software
Case Studies
Customer References
User Quotes
Webcasts
Awards
Security Whitepaper
News
Support
Knowledge Base
Updates & Upgrades
Documentation
Requirements & Licensing
Training
Feature Request
Technical Support Home

Tech Blog
Feedback

Introduction

ProGen WebSmart has many facilities for enabling you to leverage existing application logic in WebSmart web applications. These facilities make it possible for you to reuse code with ease, and to separate the business rules and database processing from the user interface. For example, you might have a complex item pricing module that depends on a customer's purchasing volume, region or number of units ordered. You can package that module in any number of ways so that it can be readily included in your application's business logic in WebSmart produced applications.

Types of Code Components You Can Include

WebSmart has features for supporting almost any kind of code or application logic you may have on your AS/400. These include objects such as programs, modules or service programs, or code snippets such as subroutines or inline code fragments. There is also full support for RPG ILE subprocedure or C function calls (a module or service program may contain any number of subprocedures or functions, for example).

Object Calls

  • Modules or Service programs written in any ILE language (for example: RPG, C, C++, CL ).
  • Programs written in any language - OPM or ILE (for example: OPM RPG, COBOL, CL, etc.)
  • Programs written in Java (via a CL call).

Any of these calls can send or receive information using parameters or, in the case of Java, a similar mechanism. The WebSmart programming language, PML, includes instructions to allow you to directly call these objects and to send or receive parameters . These are the CALL and CALLB functions, similar to how you would code them in ILE RPG.

Code Snippets and Subroutines

Any code snippet written in ILE RPG can also be included. Your code snippet can consist of a combination of global (program level) or local (subprocedure level) variables (D-specs) or calculations. When the code is included in the generated program, the generator sorts out which part of the source the D-specs belong in. It also eliminates duplicate field declarations. This means your code snippets can be self-contained, complete pieces of code from one source member, instead of having to create 2 or more source members- one for the D-Specs and another for the calculations (C-specs).

You can include code snippets in several ways:

  1. In WebSmart, define a 'program field' that runs the code in the snippet and returns a value to that field. This process allows you to specify any code you want to run for that program field. Wherever you use the program field in the WebSmart IDE, the generator will automatically include your code snippet to ensure it gets evaluated correctly.
  2. Extend the programming language that is a part of WebSmart (the PML). This involves prototyping a PML function that maps to the corresponding ILE RPG code snippet. You can also use this technique to encapsulate calls to modules, programs or subprocedures written in any ILE language. Chapter 20 of the User Guide explains this in detail.

Note that when you use this feature, you are actually extending the language vocabulary. These extensions are stored in files that are unaffected by subsequent installs of the product, so you never have to worry about losing them. In addition, you get all the benefits of the IDE' s PML editing features with this approach: color coding, prototyping, type-checking and syntax checking.

How WebSmart Handles Binding in Modules and Service Programs

Whenever you use the CALLB function in PML, WebSmart automatically adds a binding entry to the compile command when the program is compiled, to ensure that the module you have referenced is automatically bound in by copy in your program.

There is also a user-customizable binding directory included with the product. You can add entries to this for either modules or service programs to automatically bind the objects needed whenever you compile any WebSmart program. Please note that the presence of an entry in the binding directory does not mean that your objects are cluttered with unnecessary modules or references to service programs. The compiler is smart enough to only include those objects really used by a program.

If you choose to extend the PML by creating customized functions that depend on calls to modules or service programs, you can also add entries to the user-customizable binding directory in order to ensure that when these functions are used, any necessary modules or service programs are bound in.

Modifying the Templates to Include Legacy Code

If there is a standard piece of legacy code that you want to include in every WebSmart definition you create (perhaps you have a standard security function), you can modify the templates to include PML code to invoke that routine - whether via a program field, a CALL or CALLB, or with a user-defined function. Of course, you can include any number of standard routines. By changing the templates before you start the code writing phase of your project, you guarantee that each program you produce will contain the legacy code.

Using the Central Repository to Include Legacy Code

For any field in any file, you can include references to legacy code by writing PML functions such as CALL or CALLB, or user-defined functions and store this information in the Central Repository. Then, whenever you reference that field as you are designing your program, the PML extensions will be included, thus referencing your legacy code.

Summary

ProGen WebSmart provides you with the best of both worlds when it comes to web application development. You get a robust, easy to use design tool that lets you build browser-based user interfaces that take maximum advantage of the browser's presentation features, you get a comprehensive programming language for writing web-based programming logic, and you can easily incorporate existing application logic into your WebSmart web applications. All these features, along with the wizards for quickly building applications, make it possible for you and your development team to reach an unsurpassed level of productivity and efficiency in producing scaleable, secure and robust AS/400 web applications.