Page 1 of 1

Calling RPG program via DEF_MTH_EX / DEF_MAP_EX

Posted: Thu Jan 31, 2019 4:11 am
by IvanR
I've been working on a Web Service that call a function wrappering a reusable part that calls an RPG program. The RPG is called using DEF_MTH_EX / DEF_MAP_EX, and returns a number of NChar and Date parameters. It didnt sends me an error back (or nothing I can see from the logs) but not returning any values as well. Has anybody has worked on DEF_MTH_EX and have it worked?

I tried to isolate the problem, so I created a simple RPG program that returns 1A character with a hard-coded value and it returns a blank. Can anybody see if I missed anything or any place I should be looking for errors? Thanks
RPG1.png
RPG1.png (8.94 KiB) Viewed 6732 times
Code1.png
Code1.png (16.2 KiB) Viewed 6732 times

Re: Calling RPG program via DEF_MTH_EX / DEF_MAP_EX

Posted: Thu Jan 31, 2019 8:36 am
by MarkD
I could be wrong, and assuming you are just using CRTRPGPGM to create it as a *PGM object, then I think that to call your test program you would code something like this:

Code: Select all

Define Field(#TestParm1) Type(*CHAR) Length(1)

Call Pgm(TESTPGM) Parm(#TestParm1)

Message Msgtxt("TestParm1 returned as =>" + #TestParm1 + "<=")

You should be able to find the message in the server module's job log.

This might be different to how to call your actual program of course.

Re: Calling RPG program via DEF_MTH_EX / DEF_MAP_EX

Posted: Thu Jan 31, 2019 4:45 pm
by KevinW
When you say that you have looked at logs, have you looked at the job log for whichever job you are executing this in?

Also, have you tried making the DEF_MAP_EX for FOUND be FOR(*BOTH)?

If neither of these suggestions help, you may want to report the issue to local LANSA Support.