dBase III Subroutines ----- --- ----------- DBase III allows for many applications to be performed, yet a few necessary tasks are unavailable using commands alone. For example, punctuating numbers. The PICTURE clause allows for formatting numbers while using @ GET's only - there is no PICTURE clause for displaying numbers on a printout. Because of this, I have developed a subroutine to punctuate numbers. DBase III also, has no command for determining the number of month between two dates. Therefore, I have created a subroutine to do this, as well. The following subroutine will place commas into numbers up to 9 digits in length. The number to which punctuation is desired is NUMBER, resulting value is placed in NUMOUT. Negative numbers will be preceeded by a hyphen '-'. For example the number 123456789 will result in 123,456,789. IF NUMBER < 0 SGN = '-' NUMBER = -(NUMBER) ELSE SGN = ' ' ENDIF * NUMC = STR(NUMBER,9) * DO CASE CASE NUMBER >= 1000000 NUMOUT = SUBSTR(NUMC,1,3)+','+SUBSTR(NUMC,4,3)+','+SUBSTR(NUMC,7,3) CASE NUMBER >= 1000 .AND. NUMBER < 1000000 NUMOUT = SUBSTR(NUMC,4,3)+','+SUBSTR(NUMC,7,3) CASE NUMBER < 1000 NUMOUT = NUMC ENDCASE * NUMOUT = SGN + NUMOUT The following subroutine will determine the number of months between two dates - NEW_DATE (most recent date) and OLD_DATE, resulting value is placed in NUM_MTHS. NEWMTH = MONTH(NEW_DATE) NEWYR = YEAR(NEW_DATE) OLDMTH = MONTH(OLD_DATE) OLDYR = YEAR(OLD_DATE) * IF NEWYR # OLDYR FIRST = 13 - OLDMTH SECOND = NEWMTH - 1 THIRD = (NEWYR - OLDYR - 1) * 12 NUM_MTHS = FIRST + SECOND + THIRD ELSE NUM_MTHS = NEWMTH - OLDMTH ENDIF by Shawnn L. Wilmoth uploaded by R. R. Richardson ID1272 Gene Plantz's BBS in Chicago