Direct calling LANSA functions from COBOL

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
Taku Izumi
Posts: 63
Joined: Thu Dec 15, 2016 2:03 pm

Direct calling LANSA functions from COBOL

Post by Taku Izumi »

Hi,

Our customer using IBM i COBOL wants to call LANSA functions directly from COBOL.
There are RPG and CL samples in DC@F28, but there are no COBOL samples.
Does anyone have an example for calling LANSA functions from COBOL?

Best regards,
Taku
René Houba
Posts: 220
Joined: Thu Nov 26, 2015 7:03 am

Re: Direct calling LANSA functions from COBOL

Post by René Houba »

Hi Taku,

I have never seen an example related to this.
You might ask LANSA Support.
stevelee67
Posts: 22
Joined: Tue Mar 13, 2018 8:25 am
Location: Madison WI

Re: Direct calling LANSA functions from COBOL

Post by stevelee67 »

i'm not a COBOL guy (nor do i play one on TV) but i assume that it would be the same as any other external program call. you need to make sure your library list is correct but:
LANSA REQUEST(RUN) PROCESS(pppppppppp) FUNCTION(fffffff) PARTITION(xxx) should work.
(you may need to be able to call the exchange list function as well: M@EXCH )

if that doesn't work, you might need to wrap a CL around the Lansa call.

here is a reference to some documentation about this kind of thing (not specific to COBOL). it's focused on the exchange list handling, and it's not terribly illuminating, but it should give at least a starting point.
https://docs.lansa.com/14/en/lansa015/c ... nge_c2.htm
The path to wisdom does, in fact, begin with a single step. Where people go wrong is in ignoring all the thousands of other steps that come after it.
Hogfather (Terry Pratchett)
Taku Izumi
Posts: 63
Joined: Thu Dec 15, 2016 2:03 pm

Re: Direct calling LANSA functions from COBOL

Post by Taku Izumi »

Hi,

LANSA Support also had not a sample for this.
I tried writing COBOL program, but found that I had to redefine so many fields used in the RPG sample, since COBOL doesn't allow field IDs containing @. It's hard work, so I gave up COBOL.
I am going to suggest the customer to use CL program.

Thanks,
Taku
Post Reply