Reading a file in AS/400

1215 pts.
Tags:
Physical Files
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?

 

Answer Wiki

Thanks. We'll let you know when a new response is added.

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

Discuss This Question: 3  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • philpl1jb
    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
    49,570 pointsBadges:
    report
  • rajeshece
    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.,
    1,215 pointsBadges:
    report
  • philpl1jb
    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
    49,570 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following