|
SQL's set based nature allows for some very elegant solutions. Display
programs are a perfect fit for SQL cursors. I only wish IBM would
implement the ability to position on data values within a cursor.
Try doing something like this using RLA. The file contains zipcodes and
lat/long values. STRQM will prompt the user for &zip and &mileage when it
is run.
SELECT B.ZIPCODE AS ORIGINALZIP, A.ZIPCODE AS DESTINATIONZIP,
CAST(SQRT( POWER(ABS(A.LAT-B.LAT)*69.1,2) +
POWER(ABS(A.LONG-B.LONG)*53,2) ) AS DEC(5,2))
AS MILEAGE
FROM BS660F AS A
INNER JOIN
BS660F AS B
ON SQRT( POWER(ABS(A.LAT-B.LAT)*69.1,2) +
POWER(ABS(A.LONG-B.LONG)*53,2) ) < &MILEAGE
WHERE B.ZIPCODE = &ZIP
ORDER BY MILEAGE DESC
Regards,
Mark
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.