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

What are different ways to pass data between programs and which one is the efficient way?

5 Answers  


1.The questions have given an array declaration and move operation then this statement is correct or not?

3 Answers   TCS,


As Packed veriable store 2 digits in 1 byte and ZONE variable store 1 digit in 1 byte... Please tell me when we have to use Packed and Zone variable...?

1 Answers  


How to update physical file in rpgle without using display file?

4 Answers   GalaxE, IBM, TCS,


Hi, I am getting the error in RPG (All Record Formats for externally-described file ABCD ignored or dropped due to error; file ignored.) Please suggest any

2 Answers   Satyam,


In RPG program one file using as a PRIMARY file while running program some of the records reading twice any body know why its happening

2 Answers  


I have file with data as follows data 1 2 3 4 5 I need to read 1 and 5 ,then 2 and 4 then like.. upto end of file, can any one help on this

3 Answers   ISG,


what are the types of identifers

2 Answers   IBM,


In a particular program one file is used where override command is applied to a file, now this program calls another program where we want to use the same file but without override.How it can be done?

6 Answers   Hexaware,


1.Can any body share me about thease opcodes with example please.Im new for AS/400.Could u please tell me in real senario? 1.TESTN, 2.EVAL 3.EVALR, TIME, 4.MONITOR 5. ENDMON 6.ON-ERROR 7.COMMIT ROLLBACK?

1 Answers   CSC,


how can an indexed file be used as arrival sequence in RPG?

3 Answers   IBM,


What is I90(Insure 90)?

1 Answers  


Categories