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
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 |
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 |
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 |
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 |
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?
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.
What you have to do in the display file when you are using message subfile?
How can we call CL program to RPG? How many number of parameter we can pass
I know chain keyword retreive records randomly but how chain keyword exactly works internally????
we are sending data of physical file to screen design and it is showing no record why?
What is the difference between copybooks and subprocedures in as400?
how can we can we the data decimal error?how can we open such file in support
what is ment by "MDT"
1) How to define keyed file in CL pgm. 2) How can i read particular records in CL pgm from database file.
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?
how to display all the members records in a physical file without using ovrdbf?