Reading a file in AS/400
525 pts.
0
Q:
Reading a file in AS/400
I wanted to read a Physical file based on library.

Eg: One master file is available in most of the libraries. I wanted to change some data in that file. So i wanted 2 read file in all the libraies.

how to achieve this using program?

 

ASKED: Nov 4 2009  7:28 AM GMT
0
24610 pts.
0
A:
 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0
  • AddThis Social Bookmark Button
Process them one at a time .. like this?

FFile1 uf e Disk Extfile(FilNam) USROPN

...
D FilNam S 21a


FilNam = lib1 + '/FILE1' // must be caps
Open File1
exsr proclib
Close File 1
FilNam = lib2 + '/FILE1' // must be caps
Open File1
exsr proclib
,,,

Phil
Last Answered: Nov 4 2009  8:30 AM GMT by Philpl1jb   24610 pts.
0
0
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Philpl1jb   24610 pts.  |   Nov 4 2009  8:34AM GMT

Alternatively you could make a logical file over the files in all libraries and use that or you could make an SQL view or statement which is a union over the files in all libraries and use that.in your program
Phil

 

Rajeshece   525 pts.  |   Nov 10 2009  1:47PM GMT

Above sample code help to read the file in 1 library. How to read the file in all library?
Eg: File is available in lib1, lib2 and lib3. All the three libraries are not available in library list.
First i want to read the file in lib1. Then i will perform above operation. Then i will read the file in lib2 etc.,

 

Philpl1jb   24610 pts.  |   Nov 10 2009  11:46PM GMT

FFile1 if e Disk Extfile(FilNam1) USROPN
FFile2 if e Disk Extfile(FilNam2) USROPN
FFile3 if e Disk Extfile(FilNam3) USROPN


D FilNam1 S 21a
D FilNam2 S 21a
D FilNam3 S 21a
FilNam1 = lib1 + ‘/FILE1′ // must be caps
Open File1
FilNam2 = lib2 + ‘/FILE1′

Open File2
FilNam3 = lib3 + ‘/FILE1′
open file3
exsr proclib

In Proclib you can read from file1, file2, file3
to compile
Ovrdbf File1 mylib1/myfile1 override all three files
issue crtrpgpgm command

Phil

 
0