AS400 Mid Range/logical files...or not

Advertisement


Question
I have 4 phyical files, each with a different record format.  One of these files contains the header record while the other files contain different detail records. Users maintain a status field in the header record.  I'm interested in copying only selected records from these files into a work file...e.g., header records with status = 'S' and all the detail records that relate (by means of keys) to such header records.  I thought a logical file definition would do it...but I don't see a select/omit mechanism to select only the detail records that relate to the header records I've selected.  Can you offer any suggestion or direction?

Answer
Presuming that the detail records share a key field with the header record such as an order number, invoice number, customer number, or so on, typically you would write an RPG program to read the header record, selecting only those with the status code you want, then execute a subroutine for each detail file, to set lower-limit on the detail file and then read-equal, based on the key field. Write the data you want to a work file you design, organized by whatever key fields suit your need.

- Laird

AS400 Mid Range

All Answers


Answers by Expert:


Ask Experts

Volunteer


Concise Systems/Laird Scranton

Expertise

General AS/400, RPG/400, SDA and CL programming questions. AS/400 performance tuning.

Experience


Past/Present clients
CB Sportswear
Coca-Cola of New York
Encore Paper Company
Golub Corporation
HBO Home Video
Imperial Pools
Kaiser Permanente of NE New York
Mallinckrodt Medical
Marigold Foods
Manpower & Associates
National Datacomputers
New York State Easter Seals Society
New York State Food Merchants Association
Pepsi-Cola Allied Bottlers
Petricca Construction
Taconic Telephone Corporation
TOMRA Recycling
Unistress Corporation

©2012 About.com, a part of The New York Times Company. All rights reserved.