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
How to handle duplicate error handling in RPG?
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
is this a rpg channel?
do you use message subfiles? What are the necessary keywords required coding a message subfile?
1.Load an runtime array of length 99 from the pf and you want to handle all the possible errors?
how can I tell when to replace the array?
what is the procedure and explain about real time scenario.
What is the difference between copybooks and subprocedures in as400?
explain sflclr, sflend, sfldlt, and sflcsrrrn?
what is a rpg?
What is the diff bw PF/LF Name and their Record format name? what is restriction in record format then file name?
what is file information data structure?
can I touch the array during treatments?
what is the rpg system?
what are the key words you must use when using a subfile?