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 |
am 2010 passed out . can any one tell me which course is good to put 2+fake .guide me
Mr.Sidc sirfor my question{how to convert date format from one format to another i think in CL/400 its CVTDAT,Please tell in RPG/400 sir not in RPGILE} you have answered using MOVE opcode,can you illustrate me with a small example sir very kind of you.
suppose if we want to update the data in cl what we will do?
Please tell me how to read the records from a file with load an array of size with error conditions(The logic answer for this question is ARR is array of 99 elements Z-ADD 0 IDX *LOVAL SETLL FILE READ FILE 99 *IN99 DOWEQ *OFF IDX ANDLT 99 ADD 1 IDX MOVE FIELD ARR,IDX READ FILE 99 ENDDO).So,Please give me the complete of this code.
thanks mr.Harshad R Suryawaunshi,i'm new to as400 i think you are telling in rpgile i know only rpg400 if possible can you tell in rpg400
You have a *USE authority on a Library and *All authority on a file in that Library.Can you change the data in that file?
how to find whether a date format is valid or not in RPG400 not in RPGILE.Can you please write the coding for this sir,i'm new to AS400.Please help.
Suppose my file has 10 fields and I want to make the 2nd field zeros in all records. And assume I have millions of records and I dont want to read each record and update the desired field with 0. Any other way to do this in one step operation?
how to check on which PF , the LF is dependant ?
is this a rpg channel?
what procedure should we use to find whether the following operations are successful or not setll setgt chain read reade readp pls tell with example i'm not lazy to read the manual or not lazy to do anything.but sometimes i cannot understand the things given in manual in high level english its little bit complicated for me,i can't understand their way of writing thats why i ask these questions here and find the solution in simple words that i can understand thats the real reason sir.sorry if i had hurt you or disturbed you.please understand my situation.
What is the length of Signature?