Retrieving data from the LDA
Retrieving data from the LDA
How do we go about retrieving information from an LDA on the ibmi we are referencing the information from the lansa guide:
https://docs.lansa.com/14/en/lansa015/i ... hlight=LDA
But when we do a quick message show, nothing pops up:
here is a snippet of our code:
Define Field(#RETVAL) Type(*VARCHAR) Length(256)
Use Builtin(GET_CHAR_AREA) With_Args('*LDA' '*LIBL' "N" 1 900) To_Get(#RETVAL)
Use Builtin(GET_CHAR_AREA) With_Args("DA_MPY") To_Get(#COMPANY)
Use Builtin(MESSAGE_BOX_ADD) With_Args(#RETVAL)
Use Builtin(MESSAGE_BOX_ADD) With_Args('why')
Use Builtin(MESSAGE_BOX_SHOW)
Not sure if we need to import something specific for this to work or not. Any help would be greatly appreciated.
https://docs.lansa.com/14/en/lansa015/i ... hlight=LDA
But when we do a quick message show, nothing pops up:
here is a snippet of our code:
Define Field(#RETVAL) Type(*VARCHAR) Length(256)
Use Builtin(GET_CHAR_AREA) With_Args('*LDA' '*LIBL' "N" 1 900) To_Get(#RETVAL)
Use Builtin(GET_CHAR_AREA) With_Args("DA_MPY") To_Get(#COMPANY)
Use Builtin(MESSAGE_BOX_ADD) With_Args(#RETVAL)
Use Builtin(MESSAGE_BOX_ADD) With_Args('why')
Use Builtin(MESSAGE_BOX_SHOW)
Not sure if we need to import something specific for this to work or not. Any help would be greatly appreciated.
-
René Houba
- Posts: 220
- Joined: Thu Nov 26, 2015 7:03 am
Re: Retrieving data from the LDA
Hi Jared,
A local data area (*LDA) is automatically created on IBMi for each job on the system. It is initially filled with blanks and I think it has a length of 1024, type *CHAR.
This local data area should be filled with something of course.
If you start a session on the IBMi and give command:
DSPDTAARA DTAARA(*LDA)
You see an empty *LDA.
So what is the content of your *LDA when your program (job) is running?
Kind regards,
René
A local data area (*LDA) is automatically created on IBMi for each job on the system. It is initially filled with blanks and I think it has a length of 1024, type *CHAR.
This local data area should be filled with something of course.
If you start a session on the IBMi and give command:
DSPDTAARA DTAARA(*LDA)
You see an empty *LDA.
So what is the content of your *LDA when your program (job) is running?
Kind regards,
René
Re: Retrieving data from the LDA
Hi Rene,
Thanks for your response.
When we sign on it is empty as you said, but when we type in our company and branch code, it then gets populated with the data we want to retrieve which is information regarding our user profile. We then use the code attached previously to try and retrieve the data but nothing gets populated on our message box.
Your assistance will be greatly appreciated. Thank you.
Thanks for your response.
When we sign on it is empty as you said, but when we type in our company and branch code, it then gets populated with the data we want to retrieve which is information regarding our user profile. We then use the code attached previously to try and retrieve the data but nothing gets populated on our message box.
Your assistance will be greatly appreciated. Thank you.
-
René Houba
- Posts: 220
- Joined: Thu Nov 26, 2015 7:03 am
Re: Retrieving data from the LDA
Hi Jared,
Where is the code running?
Windows?
Message_box_show seems a Windows program for me, correct?
Kind regards,
René
Where is the code running?
Windows?
Message_box_show seems a Windows program for me, correct?
Kind regards,
René
Re: Retrieving data from the LDA
the script is running off of a reusable part (there are just a couple of test script we were running):
Begin_Com Role(*EXTENDS #VF_AC010) Height(270) Width(500)
Define_Com Class(#vf_sy122) Name(#POSCONN) Parent(#COM_OWNER) Visible(False)
Define_Com Class(#POSSRCH) Name(#POSSRCH)
Mthroutine Name(uInitialize) Options(*REDEFINE)
* * In the command's uInitialize method routine, set the screen wrapper's uCommand property to #com_owner
Set Com(#POSCONN) uCommand(#com_owner)
Invoke Method(#POSSRCH.ShowForm)
Endroutine
Mthroutine Name(uExecute) Options(*REDEFINE)
Invoke Method(#Com_Ancestor.uExecute)
Invoke Method(#POSCONN.MakeRampTSAvailable)
Endroutine
Evtroutine Handling(#POSCONN.RampTSAvailable)
Invoke Method(#POSCONN.NavigateToScreen) Name('HN2000')
Endroutine
Evtroutine Handling(#POSCONN.vHandleArrive) ArrivedScreen(#CurrentScreen) PreviousScreen(#PreviousScreen) ArrivedPayload(#Payload)
Case (#CurrentScreen)
* /Debtor Search Screen
When Value_Is(= 'HN2000')
Define Field(#RETVAL) Type(*CHAR) Length(150)
Use Builtin(GET_CHAR_AREA) With_Args('*LDA' '*LIBL' "N" 0 150) To_Get(#RETVAL)
* Use Builtin(GET_CHAR_AREA) With_Args('*LDA' '*LIBL' "N" 1 30) To_Get(#RETVAL)
If Cond(#RETVAL <> '')
Use Builtin(GET_CHAR_AREA) With_Args("DA_MPY") To_Get(#COMPANY)
Use Builtin(MESSAGE_BOX_ADD) With_Args(#RETVAL)
Use Builtin(MESSAGE_BOX_ADD) With_Args(*TESTLDA)
Use Builtin(MESSAGE_BOX_SHOW)
Endif
* Use Builtin(MESSAGE_BOX_ADD) With_Args(#COMPANY)
Use Builtin(MESSAGE_BOX_SHOW)
Endcase
Endroutine
End_Com
Begin_Com Role(*EXTENDS #VF_AC010) Height(270) Width(500)
Define_Com Class(#vf_sy122) Name(#POSCONN) Parent(#COM_OWNER) Visible(False)
Define_Com Class(#POSSRCH) Name(#POSSRCH)
Mthroutine Name(uInitialize) Options(*REDEFINE)
* * In the command's uInitialize method routine, set the screen wrapper's uCommand property to #com_owner
Set Com(#POSCONN) uCommand(#com_owner)
Invoke Method(#POSSRCH.ShowForm)
Endroutine
Mthroutine Name(uExecute) Options(*REDEFINE)
Invoke Method(#Com_Ancestor.uExecute)
Invoke Method(#POSCONN.MakeRampTSAvailable)
Endroutine
Evtroutine Handling(#POSCONN.RampTSAvailable)
Invoke Method(#POSCONN.NavigateToScreen) Name('HN2000')
Endroutine
Evtroutine Handling(#POSCONN.vHandleArrive) ArrivedScreen(#CurrentScreen) PreviousScreen(#PreviousScreen) ArrivedPayload(#Payload)
Case (#CurrentScreen)
* /Debtor Search Screen
When Value_Is(= 'HN2000')
Define Field(#RETVAL) Type(*CHAR) Length(150)
Use Builtin(GET_CHAR_AREA) With_Args('*LDA' '*LIBL' "N" 0 150) To_Get(#RETVAL)
* Use Builtin(GET_CHAR_AREA) With_Args('*LDA' '*LIBL' "N" 1 30) To_Get(#RETVAL)
If Cond(#RETVAL <> '')
Use Builtin(GET_CHAR_AREA) With_Args("DA_MPY") To_Get(#COMPANY)
Use Builtin(MESSAGE_BOX_ADD) With_Args(#RETVAL)
Use Builtin(MESSAGE_BOX_ADD) With_Args(*TESTLDA)
Use Builtin(MESSAGE_BOX_SHOW)
Endif
* Use Builtin(MESSAGE_BOX_ADD) With_Args(#COMPANY)
Use Builtin(MESSAGE_BOX_SHOW)
Endcase
Endroutine
End_Com
Re: Retrieving data from the LDA
If you want the LDA from the IBM you need to run a server function to get and return values.
Art
Art
Art Tostaine
-
René Houba
- Posts: 220
- Joined: Thu Nov 26, 2015 7:03 am
Re: Retrieving data from the LDA
Hi Art,
CORRECT
That was exactly what I was thinking!!
CORRECT
That was exactly what I was thinking!!
Re: Retrieving data from the LDA
We return the whole 1024 characters
Back and parse it on the client.
LDA is an ancient tech that was big on the SYS/36.
Back and parse it on the client.
LDA is an ancient tech that was big on the SYS/36.
Art Tostaine
-
René Houba
- Posts: 220
- Joined: Thu Nov 26, 2015 7:03 am
Re: Retrieving data from the LDA
So Jared,
Let's say that the LANSA function name on the IBMi is FUNC01.
1. In Windows you:
Use Builtin(CALL_SERVER_FUNCTION) With_Args('IBMi' FUNC01 'N' 'Y') To_Get(#RETCOD)
The 'Y' value in the CALL_SERVER_FUNCTION = "Receive exchange list back from server function"
2. On the IBMi in the LANSA function, you pickup the *LDA data and use the exchange command to return the value to the client environment:
Use Builtin(GET_CHAR_AREA) With_Args('*LDA' '*LIBL' "N" 0 150) To_Get(#RETVAL)
Exchange Fields(#RETVAL)
Kind regards,
René
Let's say that the LANSA function name on the IBMi is FUNC01.
1. In Windows you:
Use Builtin(CALL_SERVER_FUNCTION) With_Args('IBMi' FUNC01 'N' 'Y') To_Get(#RETCOD)
The 'Y' value in the CALL_SERVER_FUNCTION = "Receive exchange list back from server function"
2. On the IBMi in the LANSA function, you pickup the *LDA data and use the exchange command to return the value to the client environment:
Use Builtin(GET_CHAR_AREA) With_Args('*LDA' '*LIBL' "N" 0 150) To_Get(#RETVAL)
Exchange Fields(#RETVAL)
Kind regards,
René
Re: Retrieving data from the LDA
So to understand, we need to create a process on the LANSA IDE?
-
René Houba
- Posts: 220
- Joined: Thu Nov 26, 2015 7:03 am
Re: Retrieving data from the LDA
Correct and create in that process a LANSA function (that will be executed on the IBMi)