Welcome! Log In Create A New Profile

Advanced

Change Library in iSeries using Webdev

Posted by Ewart 
Ewart
Change Library in iSeries using Webdev
October 28, 2008 12:44PM
Hello All,

I'm a newbie in Webdev. I'm using Easycom to connect to our iSeries. In our scenario we have multiple databases of exactly the same layouts i.e. one for each division.

My idea is to develop general programs for all divisions, so the proper database will be opened depending on the division code.

I'm using the following code but still it uses the Analysis that is open. Anyone have any ideas ???

zLibnm is string
HReadSeekFirst(zprdcmp,VECOD4,Div)
IF HFound(zprdcmp) = True THEN
zLibnm = zprdcmp.VED800
HCloseAnalysis()
ASExec("OVRDBF FILE(inprxxp) TOFILE("+zLibnm+"/inprxxp) MBR(*FIRST) OVRSCOPE(*JOcool smiley")
HOpenAnalysis("C:\My Sites\SOPICDATA\SOPICDATA.wdd")
ELSE
HReadNext(zprdcmp,VECOD4)
END

HReadSeekFirst(inprxxp,EPBANB,Inv_no)
IF HFound(inprxxp) = True
FileToPage()
END

Thanks & best regards
Ewart
Ewart
Re: Change Library in iSeries using Webdev
October 28, 2008 01:31PM
I'll just explain the code, though it may not be ideal:

// String to store the library name
zLibnm is string
// Read the file for the library name depending on the value of 'Div'
HReadSeekFirst(zprdcmp,VECOD4,Div)
IF HFound(zprdcmp) = True THEN
// If the record is found store the library name
zLibnm = zprdcmp.VED800
// Closing the analsis because just the OVRDBF was not working
HCloseAnalysis()
// iSeries command to overwride the file to link to the new library
ASExec("OVRDBF FILE(inprxxp) TOFILE("+zLibnm+"/inprxxp) MBR(*FIRST) OVRSCOPE(*JOcool smiley")
// re-open the analysis
HOpenAnalysis("C:\My Sites\SOPICDATA\SOPICDATA.wdd")
ELSE
HReadNext(zprdcmp,VECOD4)
END

// Reading the data file for Invoice details based on the Inv_no.
HReadSeekFirst(inprxxp,EPBANB,Inv_no)
IF HFound(inprxxp) = True
FileToPage()
END

The problem: It does not find the invoice because the OVRDBF statemend does not work & thus ignores the FileToPage statement.

Thanks
Ewart
Gianni Spano
Re: Change Library in iSeries using Webdev
October 28, 2008 01:36PM
Hi

It could be a stupid response..

Did you try to put a THEN after the "true" word??

Gianni

Fabrice Harari.pcs.crosspost
Re: Change Library in iSeries using Webdev
October 28, 2008 02:47PM
Hi Ewart...

it seems to me that you are mistaking analysis for Database... In
WinDev, the analysis is the description (structure) of a database. It
DOESN'T refer to a specific DB (physical files on disk), just to the
structure...

So if you have several DB with the same structure, you always use the
same analysis (description) and you POINT to the physical files using
hChangeConnexion...

This mechanism goes to the point where you can access an HFCS DB, than
change to a MS/SQL one, as long as they both have the same structure,
just by changing your connexion...

I'm not familiar with easycom/iSeries, but that's the general way of
accessing DBs in wlanguage, so I don't see why it should be different in
your specific case

Hope this helps

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

More information on [www.fabriceharari.com]


Ewart wrote:
> Hello All,
> I'm a newbie in Webdev. I'm using Easycom to connect to our iSeries. In our scenario we have multiple databases of exactly the same layouts i.e. one for each division.
> My idea is to develop general programs for all divisions, so the proper database will be opened depending on the division code.
> I'm using the following code but still it uses the Analysis that is open. Anyone have any ideas ???
> zLibnm is string
> HReadSeekFirst(zprdcmp,VECOD4,Div)
> IF HFound(zprdcmp) = True THEN
> zLibnm = zprdcmp.VED800
> HCloseAnalysis()
> ASExec("OVRDBF FILE(inprxxp) TOFILE("+zLibnm+"/inprxxp) MBR(*FIRST) OVRSCOPE(*JOcool smiley")
> HOpenAnalysis("C:\My Sites\SOPICDATA\SOPICDATA.wdd")
> ELSE
> HReadNext(zprdcmp,VECOD4)
> END
> HReadSeekFirst(inprxxp,EPBANB,Inv_no)
> IF HFound(inprxxp) = True
> FileToPage()
> END
> Thanks & best regards
> Ewart
>
Message forwarded from pcsoft.us.windev
heinz kuebler
Re: Change Library in iSeries using Webdev
October 28, 2008 03:28PM
hi ewart,

fabrice is completly right, you even do not need the read the analyisis during execution of the program.

But first of all you should do the OVRDBF before you open/use the appropriate file.
I would even suggest to close all files, change the connection and use/open the files agian.

Maybe it is even easier to use the Change or ADD library list command (CHGLIBL or ADDLIBLE) then you do not have to override every single file

regards, heinz

Paulo Oliveira
Re: Change Library in iSeries using Webdev
October 28, 2008 05:35PM
you can change the LIBL when you define the connection.
just find INILIBL in the easycom help
Christian Potvin.pcs.crosspost
Re: Change Library in iSeries using Webdev
October 28, 2008 05:49PM
Hi Ewart,

If I understand correctly, 'zLibnm' contains the name of your library.
What you can do once you know the library related to the division:

ASExec("RMVLIBL " + zLibnm) // Just to be sure
ASExec("ADDLIBL " + zLibnm) // Add it on top of the job Library List
ASExec("CHGCURLIB " + zLibnm) // Just to be sure

That's all you have to do. The job libray list will be changed dynamically everytime you change division.

Christian

Ewart a écrit dans le message de news <34692008102812500377.16013@news.pcsoft.fr> :
> Hello All,
> I'm a newbie in Webdev. I'm using Easycom to connect to our iSeries. In our scenario we have multiple databases of exactly the same layouts i.e. one for each division.
> My idea is to develop general programs for all divisions, so the proper database will be opened depending on the division code.
> I'm using the following code but still it uses the Analysis that is open. Anyone have any ideas ???
> zLibnm is string
> HReadSeekFirst(zprdcmp,VECOD4,Div)
> IF HFound(zprdcmp) = True THEN
> zLibnm = zprdcmp.VED800
> HCloseAnalysis()
> ASExec("OVRDBF FILE(inprxxp) TOFILE("+zLibnm+"/inprxxp) MBR(*FIRST) OVRSCOPE(*JOcool smiley")
> HOpenAnalysis("C:\My Sites\SOPICDATA\SOPICDATA.wdd")
> ELSE
> HReadNext(zprdcmp,VECOD4)
> END
> HReadSeekFirst(inprxxp,EPBANB,Inv_no)
> IF HFound(inprxxp) = True
> FileToPage()
> END
> Thanks & best regards
> Ewart
>

Message forwarded from pcsoft.us.windev
Ewart
Re: Change Library in iSeries using Webdev
October 29, 2008 05:58PM
Hi Guys,

Thanks for the responses & suggestions. I have modified the code as below, unfortunately still not effect, maybe the sequence of operations is wrong :

zLibnm is string
MyConnection is a Connection
MyConnection..User = "XX"
MyConnection..Password = "xxxxxx"
MyConnection..Server = "xxxxxx"
MyConnection..Provider = hNativeAccessAS400
MyConnection..Access = hOReadWrite
MyConnection..ExtendedInfo = "<EASYCOM>"+CRLF+"JOBNAME=WINDEV"+CRLF+"</EASYCOM>"
HOpenConnection(MyConnection)

HReadSeekFirst(zprdcmp,VECOD4,Div)
IF HFound(zprdcmp) = True THEN
zLibnm = zprdcmp.VED800
// Copied from one of the suggestions
ASExec("RMVLIBL " + zLibnm) // Just to be sure
ASExec("ADDLIBL " + zLibnm) // Add it on top of the job Library List
ASExec("CHGCURLIB " + zLibnm) // Just to be sure
HClose(inprxxp)
HChangeConnection(inprxxp,MyConnection)
HOpen(inprxxp)
ELSE
HReadNext(zprdcmp,VECOD4)
END

HReadSeekFirst(inprxxp,EPBANB,Inv_no)
IF HFound(inprxxp) = True
FileToPage()
ELSE
Info("Invoice "+ Inv_no + " not found")
END
Paulo Oliveira
Re: Change Library in iSeries using Webdev
October 31, 2008 07:47PM
i think that if you remove the HChangeConnection it will work if you don't have the libary defined in the analysis.
If you change the LIBL with ASEXEC, you don't need to do nothing with the connection.

PS: Did you check the analysis, in the file description, you have some extended information for the easycom driver, don't include the library in the table name or in the easycom information and it should work.
Geert Debruyne
Re: Change Library in iSeries using Webdev
November 06, 2008 04:15PM
Hi Ewart,

your problem was something we struggeled with too...
First be sure that there is NO library stored in the analyses; Easycom does this when you put in a library name when putting tables from the iSeries into your analyses.
Because afterwards, even if you change the librarylist, you still be using the wrong library (always the one mentioned in the analyses).
So, this is the first thing to check: NO library in the analyses;
From then, you have some methods of using a libl on the iSeries:
- setting it from within the Windev/webdev-application using ASEXEC
- changing the Easycom-ini-file, but this will require a new hopenconnection...

First solutions worked fine for us...

Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: