Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

I have a Physical File name 'File1', which is present in
two libraries named 'LIB1' & 'LIB2'. These 2 libraries are
listed in the library list. Would like to access data from
this file from these two libraries using RPG program. How
to do this, any idea?

Answer Posted / swetha p rao

1. Declare the file File1 in Useropen mode and use OVRDBF
with that library name before you open the file through
QCMDEXC

OVRDBF (LIB1/FIle1) SHARE(*YES)
Open File1
Read File1
.....
Close File1

OVRDBF (LIB2/FIle1) SHARE(*YES)
Open File1
Read File1
.....
Close File1

(or)

Use SQLRPGLE ,Declare a cursor for both files
c+ exec-sql
c+ Declare Cursor C1
c+ Select * from LIB1/File1
c+ End exec

c+ exec-sql
c+ Declare Cursor C2
c+ Select * from LIB2/File1
c+ End exec



Correct me if iam wrong

Is This Answer Correct ?    15 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the purpose of record level identifier?

1132


1. What is bound-by-call and bound-by-reference? 2. Where and why is *Nomain used? 3. What are the difficulties faced by programmers when using service programs? 4. Explain the different ways of parsing and compiling XML in iSeries.

6524


Hi Viewers can any body explain me how to update and ahange the already existed data in physical file using subfile ? please explain me with the code if possible?

5154


write an RPG program to calculate the marks of 5 students (A,B, C, D, E)in 3 different subjects (eng, math, sci) an display on the screen

1322


Assume 2 users are using the same file and first user updates some record in the file. Will the 2nd user will be able to see the updated record or not?

952


We have job which is running as batch. It takes atleast 06 hours to complete tht job. But I wanna do tht job with in 3 hours?

1252


are there any useful c runtime apis that I can call from rpg iv?

1174


When it is desirable to describe files Internally?

1724


what is the difference between do while and do until?

1263


How to create a login screen using a command instead of display file.... intention is to get a password field on a command..... how do you achieve this...

1898


How can we override a file during runtime in rpg?

1211


When we have a file with Duplicate records and I want to read the unique record from the file. For example a file containing Emp Name as 'Ram' and there are 3 entries of it. So how to read a unique record from File?

968


How Chain operation copies the record's data to the input buffer for the program?

1617


what is file information data structure?

2215


How do u design a physical file, when you have 2 Unique fields like for eg in A student file student ID and student examination no both are unique

1027