Page 1 of 1

Server Modules: automatically included routines and statements

Posted: Fri Sep 26, 2025 5:30 pm
by Joerg Hamacher
Hi everybody,

we are using server modules on IBMi for providing data to be shown on web pages.
To be able to test everything without touching the production data we have written a reusable part to set up the correct library list.
This reusable part we call in a method routine in our server modules like ths:

Mthroutine Name(m_SetLibraryList)
* =====================================
* Definition: ReusableParts
* =====================================
Define_Com Class(#Retrieve_DTAARA_SMHRUNTIME) Name(#Retrieve_DTAARA_SMHRUNTIME)
* =====================================
* Bibliotheksliste setzen
* =====================================
#Retrieve_DTAARA_SMHRUNTIME.m_ADDLIBL I_Fibu("J") I_Lansa("J") I_Wws("J") I_OnlyFiles("N") I_Environment("TEST")
Endroutine


And then we call this method routine in every server routine like this:

Srvroutine Name(FindArtikelumsatz)
Field_Map For(*INPUT) Field(#SMHMANDAN)
List_Map For(*OUTPUT) List(#l_Artikelumsatz)
List_Map For(*OUTPUT) List(#l_Filialen)

* Bibliotheksliste setzen
#COM_SELF.m_SetLibraryList


Is there a way to let this be done automatically by VL when creating a server module?
Something like a server routine template that VL uses for creating that can be adapted?
Or a change in the #PRIM_SRVM definitions?

Many thanks in advance, Jörg

Re: Server Modules: automatically included routines and statements

Posted: Mon Sep 29, 2025 7:24 am
by davidbalansa
Hi Joerg,

You could build your own building block template in LANSA:

https://docs.lansa.com/16/en/lansa015/i ... 257C_____0

I am not sure if LANSA have included RDMLX component types into the Template commands. But at a minimum you could use the comment command to generate the code.

Code wise. You could create a shared server object (reusable part) to contain your common server side routines. LANSA provide a shipped Server Module DF_T53DSO showing an example of this. It should reduce the lines of code you need to add to each of your server modules.
Screenshot 2025-09-29 071410.jpg
Screenshot 2025-09-29 071410.jpg (73.78 KiB) Viewed 13331 times
Hope this helps some.

Re: Server Modules: automatically included routines and statements

Posted: Mon Sep 29, 2025 8:59 am
by davidbalansa
Hi Joerg,

I had a quick look at the LANSA Templates, it's been a while. There are no RDMLX restrictions. You can build a whole server module template and /or a server routine building block template.

I created a very simple server module template (based on DF_T53DSO) without any question / answer capabilities. I attached the VL (15) quick export of the template.

QuickExport20250929084528.zip
(5.18 KiB) Downloaded 151 times

Re: Server Modules: automatically included routines and statements

Posted: Mon Sep 29, 2025 10:17 pm
by Joerg Hamacher
Hello David,

Thank you very much for the export file.
However, I am now unsure how to process it further.

How do I create a real server module using this template?
If I want to create a new function, I can enter the template—but how does that work with a server module?

Best regards,
Joerg

Re: Server Modules: automatically included routines and statements

Posted: Thu Oct 02, 2025 11:19 am
by davidbalansa
Hi Joerg,

You are correct, it's not as nice as creating a function using a template.

For a server module:
1. Create a server module and open it in the IDE.
2. Delete all the RDMLX generated in the server module so that it is empty.
3. Select the run template option from the Home ribbon.
4. Select your template to run.
5. The template generated code is inserted into the server module in the IDE.

Screenshot 2025-10-02 110258.jpg
Screenshot 2025-10-02 110258.jpg (21.92 KiB) Viewed 13266 times
Regards,
David