Hi,
Can anyone help me with accessing multiple files data on the AS400? I have tried the select_sql method but I do not have local data as all my data is in the 400. I can fetch data on one file, but I cannot fetch data on multiple files. Your assistance will be highly appreciated.
Fetch data on multiple files
-
cesarrafael
- Posts: 32
- Joined: Tue Dec 01, 2015 3:44 am
Re: Fetch data on multiple files
Hi FBuckham,
Can you be a little bit more specific? What are you trying to achieve? Is it client/server data fetch? Is it OTHER File data?
Can you be a little bit more specific? What are you trying to achieve? Is it client/server data fetch? Is it OTHER File data?
Re: Fetch data on multiple files
In normal sql i want to :
Select (Fields) from tableA, tableB Where tableA.id = tableB.id
This is what I found on this
SELECT_SQL FIELDS((#EMPNO PSLMST.EMPNO) #SKILCODE #DATEACQR) FROM_FILES((PSLMST)(PSLSKL)) WHERE('PSLMST.EMPNO=PSLSKL.EMPNO AND SKILCODE=''4GL''') ORDER_BY(DATEACQR);
But with the previous method, the problem is that it is looking at the local db and not the db2(as400)
Thank you.
Select (Fields) from tableA, tableB Where tableA.id = tableB.id
This is what I found on this
SELECT_SQL FIELDS((#EMPNO PSLMST.EMPNO) #SKILCODE #DATEACQR) FROM_FILES((PSLMST)(PSLSKL)) WHERE('PSLMST.EMPNO=PSLSKL.EMPNO AND SKILCODE=''4GL''') ORDER_BY(DATEACQR);
But with the previous method, the problem is that it is looking at the local db and not the db2(as400)
Thank you.
-
cesarrafael
- Posts: 32
- Joined: Tue Dec 01, 2015 3:44 am
Re: Fetch data on multiple files
It's true.
To use the Select_sql in that way, you'll need to call a server function and pass data from the server function in a list to your local function
e.g. Use Builtin(CALL_SERVER_FUNCTION) With_Args(*SSERVER_SSN MYSERVFN Y Y #MYLIST) To_Get(#IO$STS)
To use the Select_sql in that way, you'll need to call a server function and pass data from the server function in a list to your local function
e.g. Use Builtin(CALL_SERVER_FUNCTION) With_Args(*SSERVER_SSN MYSERVFN Y Y #MYLIST) To_Get(#IO$STS)
-
appbuilder
- Posts: 28
- Joined: Sat Jan 16, 2016 9:53 am
Re: Fetch data on multiple files
Check out the Predetermined Join logic to link fields from other files and use the LANSA Fetch to retrieve all the data.
Thanks,
Don
Don
Re: Fetch data on multiple files
Hi
you can use USING on the SELECT_SQL to execute your SQL command - like this:
Select_Sql Fields(#DatoALFA #Ugedag #RUTTXT #RUTKOD #ton #tono #tonp #steder #linjer #linjerp #snit #Snitsavet #Ordre #ordreo #ordrep) Using(#SQLCMD)
Where you have your SQL command in the #SQLCMD and it returns the fields in the FILEDS parm. but you have to run it on the server.
you can use USING on the SELECT_SQL to execute your SQL command - like this:
Select_Sql Fields(#DatoALFA #Ugedag #RUTTXT #RUTKOD #ton #tono #tonp #steder #linjer #linjerp #snit #Snitsavet #Ordre #ordreo #ordrep) Using(#SQLCMD)
Where you have your SQL command in the #SQLCMD and it returns the fields in the FILEDS parm. but you have to run it on the server.
Re: Fetch data on multiple files
I will try creating a function and running the call server function BIF. Thanks for your suggestions, they help!!