HI I have a program that used to get some data from a shipping system, that has been replaced. the previous code chained to the shipping system with Company Order# Release# getting these from the order detail table. Note that orders can have mulitple lines where it's a different item number.
Now the new shipping system does not have a release number. It does have a line counter per order# however so we would have
company order phno
001 123 1
001 123 2
001 123 3
so for the code I want to know if there is a neater way to code this.
what I think will work is,
create a logical for the above 3 columns.
create a one time only run that will move a '1' to the keylist comp, order#, counter '1' (first time of program only)
chain. move the comp and order to prev_comp, Prev_order
then next time in the sub routine, check if order# = prev_order if = add 1 to phno, chain, continue until order# not = to prev_order. then Z-add1 to counter chain, set prev fields, repeat the loop/
You could use SetLL with the first two columns and then ReadE to read every items of the order.
If your Logical file is declared as "Company, Order, PhNo", results will be ordered in the same order.
Example in free :
SetLL (Company:Order) YourFile;
ReadE (Company:Order) YourFile;
DoW not %EoF(YourFile);
... //Your logic per item here
ReadE (Company:Order) YourFile;
EndDo;