Hello all.

My code retrieves a price from a dinamically opened file. There are files every week with the list of valid prices and I search the right one through location and date.

As long as I have the location as unique in the file, the code works fine, but there can be the case that for the correct date the location was not in the file. So it should loop the opened file backwards until it loops.

The whole code is:

Please Login or Register  to view this content.
Where the part with a lot of spaces around it is the loop. If I knew how to make it work, it should go back a day in the date of an auxiliary table, that sets the file to open, but unfortunately I don't know how to do loops, so I'm only able to go a day back, and not until it finds the correct file. When it finds the location, then it should be the same as the part where the count_icao = 1.

Thank you for your help.