Calling RPG program via DEF_MTH_EX / DEF_MAP_EX

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
IvanR
Posts: 5
Joined: Fri Nov 10, 2017 6:39 am

Calling RPG program via DEF_MTH_EX / DEF_MAP_EX

Post by IvanR » Thu Jan 31, 2019 4:11 am

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 1562 times
Code1.png
Code1.png (16.2 KiB) Viewed 1562 times

MarkD
Posts: 606
Joined: Wed Dec 02, 2015 9:56 am

Re: Calling RPG program via DEF_MTH_EX / DEF_MAP_EX

Post by MarkD » Thu Jan 31, 2019 8:36 am

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.

KevinW
Posts: 28
Joined: Thu May 26, 2016 11:18 am

Re: Calling RPG program via DEF_MTH_EX / DEF_MAP_EX

Post by KevinW » Thu Jan 31, 2019 4:45 pm

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.

Post Reply