RPG to Node.js Conversion Example

Al3 (@al3)

10065

1

2

About This Space

RPG Application that allows you to work with Insurance Claims converted to Node.js to run in the cloud, using any database


Last updated on September 3, 2019

Public Permissions:   View   Open/Fork   Run   Comment  

CLAIM03R

Converting RPG IV program to run on NodeRun

This space is a proof of concept to show how an RPG IV program can be easily converted to Node.js code and pointed to a new database server that is not DB2.
No changes are made to the program code beyond running the automatic conversion to Node.js.
The original RPG source code is provided in the claim03r.txt file for reference.

Before screen shots Before

Conversion By Profound Logic

This entire process can be implemented by our services team for a specific customer project and can be applied to any system that can run Node.js. Contact the Profound Logic Services team for more information.

Manual Conversion

For a smaller project or proof of concept the conversion can be completed manually and the steps involved are provided below.

This example started with a program that already had a rich display screen which had been converted from a green screen and then enhanced with some additional features.
However, the original green screen display file could have been used instead. A copy of the converted original green screen is provided in file claim01d.json for reference.

Convert Display

Convert the display file to Rich display using the converter in Profound UI designer then save as .json file

The Profound UI designer includes a conversion option that provides a one-step method of creating a rich display from an existing DDS file.

Designer Conversion

Convert RPG code

Convert RPG code to node using Profound.js Converter command PJSCONVERT

The Profound.js converter is an automated process that accurately converts your RPG code into Node.js code that will run in the Profound.js framework.
The converter has options to help clean up code, modularize code, and even create web service stubs for all subroutines and procedures int he original code.
For this example we selected to remove dead code but otherwise keep the same single program structure.

PJS Converter

Copy both the .json file and .js file to a new NodeRun space

Upload Files

Database

Duplicate Database Table An automated process would use a DB Migration tool to make this easier but for one or two tables for a POC you can do it manually.

  • Use Manage DB2 for i in ACS to generate SQL
  • removed DB2 specific parts from create table command and ran in NodeRun
  • export data and generate an insert script to run in NodeRun

This blog post has more information about doing this manually
Using Your IBM i Tables with NodeRun

Running the create script in NodeRun

Create Script

Db Override Modules

Create Db customize modules In an automated process these modules would be programmatically generated based on the table definitions.

  • When manually creating your own POC you can use claimsp.js and claims2l.js as examples.
  • Both modules use the single table claimsp. claims2l is no longer needed
  • You can override any of the db record level access commands and can even add your own custom methods.
    For example we could add a GetClaim() method to pull all the data for a specific claim.

Rich Display Enhancement changes

This example started with an RPG prorgam that was using a Profound UI Rich Display that was enhanced with File Upload and Image widgets.

Because these widgets interact with the file system there are a couple adjustments needed to move them to another system.

  • Create a folder for images under the public folder

    Create Script

  • Change the Target Directory for the File Upload widget and the Image Source script for the Iamge widget to /public/images

    Create Script

    Create Script

  • Add a puiuplexit.js file The puiuplexit.js file is an exit module that is required to give the file upload widget permission to upload files.
    You can write your own code to verify the type, size, and directory before allowing an upload.

Comments

Write Preview Markdown: bold italic code link
Post

5 years ago

Awesome work Al.

More Spaces By Al3 (@al3)

Filters:

Popular Recent

Advanced CRUD application

Al3

14426

0

0

This workspace implements Amazon Web Services Rekognition. The application uses your device camera to take your photo, determine how old you look, and tell you all about it using human speech though the speakers on your device.

11623

1

2

This workspace implements Amazon Web Services Rekognition. The application uses your device camera to take your photo, determine how old you look, and tell you all about it using human speech though the speakers on your device.

Al3

12906

1

1

This workspace implements Amazon Web Services Rekognition. The application uses your device camera to take a photo, analyze objects in the picture, and tell you all about it using human speech though the speakers on your device.

Al3

10291

1

0

This workspace implements Amazon Web Services Rekognition. The application uses your device camera to take a photo, analyze objects in the picture, and tell you all about it using human speech though the speakers on your device.

Al3

10429

0

0

A demo of how to build, test and document APIs

Al3

8134

0

0

A demo of how to build, test and consume APIs

Al3

3701

0

0

This space creates an AWS S3 Bucket Browser using AWS SDK APIs. It allows you to create and delete buckets, list objects in a bucket, and Upload, download, preview or delete objects.

Al3

20559

1

1

This space creates an AWS S3 Bucket Browser using AWS SDK APIs. It allows you to create and delete buckets, list objects in a bucket, and Upload, download, preview or delete objects. This space is protected to protect the credentials being used for the example. To see the code or create a version to browse your own S3 buckets see http://noderun.com/al3/aws-s3-bucket-browser/

Al3

13908

1

1

Very basic file upload example using the File Upload Drag and Drop widget

Al3

16526

0

3

This app consumes a web service and display the information in a grid

Al3

11086

0

0

CRUD Application with Detail Edit Screen

Al3

2913

0

0