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?

Answers were Sorted based on User's Feedback



I have a Physical File name 'File1', which is present in two libraries named 'LIB1&..

Answer / 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

I have a Physical File name 'File1', which is present in two libraries named 'LIB1&..

Answer / divakar reddy

F FILE1 IF A E K DISK ExtFile('LIB1/FILE1')
RENAME(file1:Afile1)
F FILE1 IF A E K DISK ExtFile('LIB2/FILE1')
RENAME(file1:Bfile1)


This should work...

Is This Answer Correct ?    9 Yes 1 No

I have a Physical File name 'File1', which is present in two libraries named 'LIB1&..

Answer / manan

actually the first answer will only work in sequential
execution in CL or SQLRPG. But if we wanna to use
simultaneously in the RPG then the CL will be OVRDBF FILE 1
to LIB1 and for the file 2 Use some other file FILEXXX and
OVRDBF it to LIB2/FILE1 and in RPG use the FILEXXX so when
u refer to any operation in FILEXXX that will reflect to
FILE1 in LIB2.

Other options for RPG4 are also correct ie usinf the
EXTFILE.

Is This Answer Correct ?    0 Yes 0 No

I have a Physical File name 'File1', which is present in two libraries named 'LIB1&..

Answer / syam

In RPG use this
F FILE1 IF A E K DISK RENAME(file1:Afile1)
F FILE1 IF A E K DISK RENAME(file1:Bfile1)

In read, open and close use Afile1 and Bfile1

Is This Answer Correct ?    2 Yes 18 No

Post New Answer

More RPG400 Interview Questions

Write the subfile logic program for the given concept. Load the data to the subfile depends upon the designation where designation is not a key field?

2 Answers   TCS,


I have a file .In that file i have 3 fields. Those fields are eno, ename, esal.Keyfield is eno. In that file i have data like this for eno 1,2,3,4,5. Now i need to display 2nd record. That means i need to set the pointer on 2nd record... Then, write the complete rpg program using setll.

1 Answers  


What you have to do in the display file when you are using message subfile?

1 Answers  


How can we call CL program to RPG? How many number of parameter we can pass

2 Answers   TCS,


I know chain keyword retreive records randomly but how chain keyword exactly works internally????

4 Answers  


we are sending data of physical file to screen design and it is showing no record why?

1 Answers   NTT Data,


What is the difference between copybooks and subprocedures in as400?

0 Answers  


how can we can we the data decimal error?how can we open such file in support

1 Answers  


what is ment by "MDT"

2 Answers   TCS,


1) How to define keyed file in CL pgm. 2) How can i read particular records in CL pgm from database file.

2 Answers  


Hi,This is raju.Can any body give me the real experience answer for this question? 1.What is the significance of *MAP and *DROP in the CPY command?

3 Answers  


how to display all the members records in a physical file without using ovrdbf?

9 Answers  


Categories