Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do nest read statements on the same table?

Status
Not open for further replies.

mdinsla

Programmer
Aug 13, 2009
1
DE
Hi,
I'm not a professional programmer, but sometimes I have to modify an existing Progress program. So, now I've got some trouble when reading the same table within nested blocks. First, I took three nested "for each" statements. When I got syntax errors, I put a "repeat-loop" around it and used combinations with "find first" and "for each". Nothing seems to be correct. Does anybody has an advice, how to read three different records in the same table, when always key-fields from the previous fetched record are needed?
Thanks in advance.

current_shipfrom = shipfrom1
current_shipper = shipper1
repeat while current_shipper <= shipper2:
find first abs_mstr /* read shipper header */
where abs_shipfrom = current_shipfrom
and abs_id = current_shipper:
run save_shipper_header.
for each abs_mstr /* read shipper container */
where abs_shipfrom = header_abs_shipfrom
and abs_par_id = header_abs_par_id:
run save_shipper_container.
find first abs_mstr /* read shipper item */
where abs_shipfrom = header_shipfrom
and abs_par_id = container_abs_id:
run save_shipper_item
run generate_boxlabel_files.
end.
end.
decimal(current_shipper) = decimal(current_shipper)+1.
end.
end.

 
Use the DEFINE BUFFER statement to create aliases for your master table, then on subsequent fetch statements, use the ailas name(s) instead of the actual table name.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top