I'm doing a POC to create reports using Word Doc templates. I did all the development work on my local m/c and I am able to get the results. As a next step, I moved the new module over to profoundjs instance on IBMi. When I tried to invoke the new module from browser pointing to the IBMi instance, I get an error saying that a specific GETDATA.js file is not found
The only difference I see between the setup is that in PC server setup, I use the connector & credentials stmts in the config.js while in the case of the config.js for IBMi instance, I do not have connector & credentials stmts.
Need help to move forward.
. Actually, I make a call to an RPG pgm to get the data required to fill my word template.How to run new module on IBMi instance
-
- New User
- Posts: 7
- Joined: Tue Apr 03, 2018 6:19 pm
- First Name: Amar
- Last Name: Kumar
- Company Name: TMW Systems
- Contact:
- Megan
- Profound Logic Staff Member
- Posts: 90
- Joined: Mon Sep 11, 2017 12:15 pm
- First Name: Megan
- Last Name: Bond
- Company Name: Profound Logic
- Phone: 5623227473
- State / Province: California
- Zip / Postal Code: 92692
- Country: United States
- Contact:
Re: How to run new module on IBMi instance
Hello Amar,
We could use some additional information. Are you calling this module from Genie or outside of Genie? RPG programs that use our RPGOA Handler cannot be called unless you start the session in Profound UI / Genie. If you are calling this from Genie, have the PROFOUNDJS_COMM_HOST and PROFOUNDJS_COMM_PORT environment variables been properly updated? These variables are set only for the user's current session, so each new session will require that they be update. The commands WRKENVVAR or CHGENVVAR can be used to update the values. Additionally, you will need to check that your library list contains all the necessary libraries in proper order. Can you please clarify the order of your calls and what you are doing to execute each one? Are you starting from a CL, RPG, or JS program? The more information we have on this issue, the better we can assist you.
Thanks,
We could use some additional information. Are you calling this module from Genie or outside of Genie? RPG programs that use our RPGOA Handler cannot be called unless you start the session in Profound UI / Genie. If you are calling this from Genie, have the PROFOUNDJS_COMM_HOST and PROFOUNDJS_COMM_PORT environment variables been properly updated? These variables are set only for the user's current session, so each new session will require that they be update. The commands WRKENVVAR or CHGENVVAR can be used to update the values. Additionally, you will need to check that your library list contains all the necessary libraries in proper order. Can you please clarify the order of your calls and what you are doing to execute each one? Are you starting from a CL, RPG, or JS program? The more information we have on this issue, the better we can assist you.
Thanks,
-
- New User
- Posts: 7
- Joined: Tue Apr 03, 2018 6:19 pm
- First Name: Amar
- Last Name: Kumar
- Company Name: TMW Systems
- Contact:
Re: How to run new module on IBMi instance
For now, I'm simply calling the function from the browser using the following url and pass a parameter in the url
mybox.com:8182/crtnegltr?inpfile=NavigationLetterLayout.docx
The function makes a call to an RPGLE pgm to obtain data and then populate data into a word template. This is working file when I run it on the instance on my PC using the following url
localhost:8081/crtnegltr?inpfile=NavigationLetterLayout.docx
From what you explained, is profoundUI a pre-requisite for using profoundjs. Can we not use it from 5250 sessions?
mybox.com:8182/crtnegltr?inpfile=NavigationLetterLayout.docx
The function makes a call to an RPGLE pgm to obtain data and then populate data into a word template. This is working file when I run it on the instance on my PC using the following url
localhost:8081/crtnegltr?inpfile=NavigationLetterLayout.docx
From what you explained, is profoundUI a pre-requisite for using profoundjs. Can we not use it from 5250 sessions?
- Megan
- Profound Logic Staff Member
- Posts: 90
- Joined: Mon Sep 11, 2017 12:15 pm
- First Name: Megan
- Last Name: Bond
- Company Name: Profound Logic
- Phone: 5623227473
- State / Province: California
- Zip / Postal Code: 92692
- Country: United States
- Contact:
Re: How to run new module on IBMi instance
Hello Amar,
Thank you for the additional information! From where Profound JS can be used is determined by what is being done. If you are calling a Service RPG Program, you should be able to use this pjs.call() as you were attempting to. If you are trying to call a rich display program, the RPG Open Access Handler is needed to process it, which is currently only available in Profound UI and Genie. If you are only calling JavaScript Modules, you shouldn't have any issues. You will need modules you intend to call from Genie in a folder that is named the same as an existing library. For example, if I create a module in profoundjs/modules/mypjsmodules/, I'll need to be able to add mypjsmodules to my library list.
Is the RPGLE program you are trying to call a Service Program or a Rich Display RPG program?
Thanks,
Thank you for the additional information! From where Profound JS can be used is determined by what is being done. If you are calling a Service RPG Program, you should be able to use this pjs.call() as you were attempting to. If you are trying to call a rich display program, the RPG Open Access Handler is needed to process it, which is currently only available in Profound UI and Genie. If you are only calling JavaScript Modules, you shouldn't have any issues. You will need modules you intend to call from Genie in a folder that is named the same as an existing library. For example, if I create a module in profoundjs/modules/mypjsmodules/, I'll need to be able to add mypjsmodules to my library list.
Is the RPGLE program you are trying to call a Service Program or a Rich Display RPG program?
Thanks,
-
- New User
- Posts: 7
- Joined: Tue Apr 03, 2018 6:19 pm
- First Name: Amar
- Last Name: Kumar
- Company Name: TMW Systems
- Contact:
Re: How to run new module on IBMi instance
Its an RPGLE pgm...When I invoke the function on IBMi instance, how does the PJS.CALL connect to the the RPGLE pgm object in my library. Here's
the config file for my IBMi instance
module.exports = {
"port": 8182,
"staticFilesDirectory": "/www/profoundui/htdocs",
"pathlist": [
"pjssamples",
"KUMA",
"NEGLETTER"
],
"initialModules": {
"/hello": "pjssamples/hello",
"/hello2": "pjssamples/hello2",
"/connect4": "pjssamples/connect4",
"/crtnegltr": "negletter/crtnegltr",
"/upload": "pjssamples/upload"
},
"dbDriver": "IBMi",
"timeout": 3600
}
here's the code in the script named crtnegltr and calling an RPGLE pgm in my library
// Define Parameters
pjs.define("ordnum", { type: "char", length: 6});
pjs.define("data", { type: "char", length: 1000});
// Call Program
pjs.call("GETDATA", ordnum, data);
Here's the RPG pgm code
Columns . . . : 6 100 Browse KUMA/QRPGLESRC
SEU==> GETDATA
FMT * *. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8 ...+... 9 ...+... 0
*************** Beginning of data ***************************************************************************************
0001.00 180404
0002.00 D getData PR EXTPGM('GETDATA') 180404
0003.00 D ORDNUM_ 6A 180404
0004.00 D DATE_ 1000A 180404
0005.00 180404
0006.00 D getData PI 180404
0007.00 D ORDNUM 6A 180404
0008.00 D DATA 1000A 180404
0009.00 180404
0010.00 180404
0011.00 /free 180404
0012.00 180404
0013.00 data = '{"ORDER_NUM": "061846", "CARRIER_NAME": "DEEP BLU,INC",' + 180404
0014.00 '"CARRIER_ADDR1":"1111Sherwin Road","CARRIER_ADDR2": " ",' + 180404
0015.00 '"CARRIER_CITY": "Winnipeg","CARRIER_STATE": "MB",' + 180404
0016.00 '"CARRIER_ZIP": "R3H OT8","CARRIER_CONTACT": "Mike Smith",' + 180404
0017.00 '"CARRIER_PHONE": "121-212-2222", "CARRIER_FAX":"212-212-3333",' + 180404
0018.00 '"CARRIER_EMAIL": "msmith@gmail.com",' + 180404
0019.00 '"payterms": [{ "term" :"This is the first payment term"},' + 180404
0020.00 '{ "term" :"This is the second payment term"},' + 180404
0021.00 '{ "term" :"This is the third payment term"},' + 180404
0022.00 '{ "term" :"This is the fourth payment term"}' + 180404
0023.00 '] }' ; 180404
0024.00 180404
0025.00 return ; 180404
0026.00 *inlr = *on ; 180404
0027.00 /end-free 180404
the config file for my IBMi instance
module.exports = {
"port": 8182,
"staticFilesDirectory": "/www/profoundui/htdocs",
"pathlist": [
"pjssamples",
"KUMA",
"NEGLETTER"
],
"initialModules": {
"/hello": "pjssamples/hello",
"/hello2": "pjssamples/hello2",
"/connect4": "pjssamples/connect4",
"/crtnegltr": "negletter/crtnegltr",
"/upload": "pjssamples/upload"
},
"dbDriver": "IBMi",
"timeout": 3600
}
here's the code in the script named crtnegltr and calling an RPGLE pgm in my library
// Define Parameters
pjs.define("ordnum", { type: "char", length: 6});
pjs.define("data", { type: "char", length: 1000});
// Call Program
pjs.call("GETDATA", ordnum, data);
Here's the RPG pgm code
Columns . . . : 6 100 Browse KUMA/QRPGLESRC
SEU==> GETDATA
FMT * *. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8 ...+... 9 ...+... 0
*************** Beginning of data ***************************************************************************************
0001.00 180404
0002.00 D getData PR EXTPGM('GETDATA') 180404
0003.00 D ORDNUM_ 6A 180404
0004.00 D DATE_ 1000A 180404
0005.00 180404
0006.00 D getData PI 180404
0007.00 D ORDNUM 6A 180404
0008.00 D DATA 1000A 180404
0009.00 180404
0010.00 180404
0011.00 /free 180404
0012.00 180404
0013.00 data = '{"ORDER_NUM": "061846", "CARRIER_NAME": "DEEP BLU,INC",' + 180404
0014.00 '"CARRIER_ADDR1":"1111Sherwin Road","CARRIER_ADDR2": " ",' + 180404
0015.00 '"CARRIER_CITY": "Winnipeg","CARRIER_STATE": "MB",' + 180404
0016.00 '"CARRIER_ZIP": "R3H OT8","CARRIER_CONTACT": "Mike Smith",' + 180404
0017.00 '"CARRIER_PHONE": "121-212-2222", "CARRIER_FAX":"212-212-3333",' + 180404
0018.00 '"CARRIER_EMAIL": "msmith@gmail.com",' + 180404
0019.00 '"payterms": [{ "term" :"This is the first payment term"},' + 180404
0020.00 '{ "term" :"This is the second payment term"},' + 180404
0021.00 '{ "term" :"This is the third payment term"},' + 180404
0022.00 '{ "term" :"This is the fourth payment term"}' + 180404
0023.00 '] }' ; 180404
0024.00 180404
0025.00 return ; 180404
0026.00 *inlr = *on ; 180404
0027.00 /end-free 180404
- Megan
- Profound Logic Staff Member
- Posts: 90
- Joined: Mon Sep 11, 2017 12:15 pm
- First Name: Megan
- Last Name: Bond
- Company Name: Profound Logic
- Phone: 5623227473
- State / Province: California
- Zip / Postal Code: 92692
- Country: United States
- Contact:
Re: How to run new module on IBMi instance
Hello Amar,
This should work if your configuration file is completed. We were able to call the RPG program you have provided after creating connector credentials and adding the path to them in the configuration file. Could you please try adding the "connectorCredentials", http://www.profoundlogic.com/docs/displ ... redentials, and "connectorLibrary", http://www.profoundlogic.com/docs/displ ... torLibrary, to your config.js file and see if that resolves your issue?
Thanks,
This should work if your configuration file is completed. We were able to call the RPG program you have provided after creating connector credentials and adding the path to them in the configuration file. Could you please try adding the "connectorCredentials", http://www.profoundlogic.com/docs/displ ... redentials, and "connectorLibrary", http://www.profoundlogic.com/docs/displ ... torLibrary, to your config.js file and see if that resolves your issue?
Thanks,
-
- New User
- Posts: 7
- Joined: Tue Apr 03, 2018 6:19 pm
- First Name: Amar
- Last Name: Kumar
- Company Name: TMW Systems
- Contact:
Re: How to run new module on IBMi instance
No luck even after adding the suggested changes in config file.
Here's what I added in the config file
Browse : /devpjs/config.js
Record : 18 of 21 by 18 Column : 1 59 by 131
Control :
....+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9....+....0....+....1....+....2....+....3.
"timeout": 3600,
"connectorCredentials":"/devpjs/credentials",
"connectorLibrary":"DEVPJS"
}
************End of Data********************
Here's what I added in the config file
Browse : /devpjs/config.js
Record : 18 of 21 by 18 Column : 1 59 by 131
Control :
....+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9....+....0....+....1....+....2....+....3.
"timeout": 3600,
"connectorCredentials":"/devpjs/credentials",
"connectorLibrary":"DEVPJS"
}
************End of Data********************
Who is online
Users browsing this forum: No registered users and 1 guest