Tip 8: How to generate a load-all subfile PJS app from Jumpstart and call it from Genie



This tip documents the steps to generate a load-all subfile PJS app from Jumpstart and call it from Genie. The PJS app is a CRUD-type app, to work with file CLAIMSP in library DEMOLIB. Please substitute your own file and your own library in the steps below. Also, for this tip, the PJS instance is called "PROFOUNDJS" and runs on an IBM i system.



Note: for a much easier way to generate a CRUD app for a file, using low-code, please see CRUD Generator.



1) Create a workspace called "pjstips". This will create directory /profoundjs/modules/pjstips. We will put the generated .js and .json files in that directory.

2) Create library "PJSTIPS" on IBM i system. We will put the proxy program in that library, to match with the sub-directory name "pjstips".

3) Launch Jumpstart. Click "Modify Library List" to include the library (DEMOLIB) that has the file (CLAIMSP) in the library list for Jumpstart.



4) Choose the inputs as shown in picture below. Note: the "Subfile type" is "Load All".

5) Click "Retrieve Fields". You'll see a panel that lists the fields, and the options you can use for those fields. Just use the defaults.

6) Scroll down to bottom of the page. On ghe "Code Generation" panel, enter the inputs as shown. Make sure the names match as indicated in the picture.



7) Click "Generate Application". The files claimspgm.js and claimspgm.json will be generated in the directory /profoudjs/modules/pjstips as shown below. The proxy *PGM object CLAIMSPGM will be created in library PJSTIPS.



8) Sign on to a Genie session. Make sure the environment variables PROFOUNDJS_COMM_HOST and PROFOUNDJS_COMM_PORT point to the correct PJS instance. If you have only one PJS instance, the default values will work fine; no change needed.

9) Make sure the Genie job's library list is as shown below.

DEMOLIB <== contains the *FILE CLAIMSP PJSTIPS <== contains the proxy *PGM CLAIMSPGM PROFOUNDUI PROFOUNDJS



10) Run command: CALL PGM(CLAIMSPGM). This will call the proxy program CLAIMSPGM in library PJSTIPS, which will look for module "claimspgm.js" in directory /profoundjs/modules/pjstips. Note that the name of the .js module "claimspgm.js" matches with the name of the *PGM object "CLAIMSPGM", and the name of the directory "pjstips" matches with the name of the library "PJSTIPS".

Also, in this case, the "pathlist" used by PJS to search for things comes from the LIBL of the Genie job, so it will find the RDF file "claimspgm.json" in the directory /profoundjs/modules/pjstips.

You should see the screen similar to the picture below.