Link to home
Start Free TrialLog in
Avatar of bhagatali
bhagataliFlag for United States of America

asked on

Access multi membered file from Java

Hi,

I am working on a file modification project which involves craeting a UI for a business team such that they are able to access the latest version of a multi membered physical file on the AS400. The UI is being written in JAVA. I am not too familiar with this and my involvement in the project is to help facilitate the backend needs.

Is there a way in Java that can help use a specific version (or the last version) of a multi membered file? We have used single membered PF's as SQL tables from the java code. We are trying to figure out how to do the same when there are more than 1 version.

Thanks
Ali
ASKER CERTIFIED SOLUTION
Avatar of gudii9
gudii9
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Theo Kouwenhoven
Theo Kouwenhoven
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
As the previous two posts point out, creating the alias in QTEMP is the best way to go. But, in case you need an alternative, you can also issue a CL command to override to the target member before running your SQL.

e.g.
OVRDBF FILE(MyTable) TOFILE(ACALIB/MyTable) MBR(TargetMbr)

HTH,
DaveSlash
Avatar of bhagatali

ASKER

@Dave: I initially was thinking of the OVRDBF command too but I am not certain of will the override remain when I execute the SQL query on that file. We know how an override on AS400 remains for the duration of a job. From Java, with all the connections and AS400 object class that have to be created I was curious if the override would still be in effect.

@murphy and @gudii: thanks for the alias and QTEMP suggestions.
Regards
Ali
The OVRDBF has always worked from me through ODBC and JDBC, but I still think the CREATE ALIAS in QTEMP is a better solution.
Sorry gudii9,

I think you posted the solution while I was still typing it.

:-)
Avatar of Member_2_276102
Member_2_276102

In general, an ALIAS can be preferred when a permanent object may be shared among users or across sessions (or across jobs). An OVRDBF can be preferred when it is known to be needed strictly local to the process.

CREATE ALIAS creates a permanent object. Technically, it's implemented as a DDM file. As such, all of the overhead of object creation (and perhaps deletion if not actually permanent) gets brought in. This includes setting ownership and authority attributes. Those attributes may cascade into changes to related objects such as the owning profile.

An OVRDBF simply puts some changes into any ODP in that job. No significant overhead.

Either one can work well. There's no real way to say one is better. It always depends on the environments in which they're used.

Tom
Thanks Tom for the added explanation.

Regards
Ali.