Comparing files FMT_C39.VB and ..\ACCESS\FMT_C39.ABC
***** FMT_C39.VB
'// ---  System: Azalea Database Extensions
'// ---  Program: FMT_C39.VB
'// ---  Copyright 1994 Jerry Whiting All Rights Reserved
***** ..\ACCESS\FMT_C39.ABC
'// ---  System: Azalea Database Extensions
'// ---  Program: FMT_C39.ABC
'// ---  Copyright 1994 Jerry Whiting All Rights Reserved
*****

***** FMT_C39.VB
'// ---             strAscSet: ASCII set to test for
'// ---                         SHORT = A-Z,0-9, -.*$/+% <space>
'// ---                         LONG  = ASCII 0-127
***** ..\ACCESS\FMT_C39.ABC
'// ---             strAscSet: ASCII set to test for
'// ---                         SHORT = A-Z,0-9, -.$/+% <space>
'// ---                         SHORT_WITH_CHEKDIGIT = add checkdigit
'// ---                         LONG  = ASCII 0-127
*****

***** FMT_C39.VB
'// ---------------------------------------------------------------- '//
Function fmt_c39 (strC39Str As String, strAscSet As String) As String

Dim true_value As Integer
Dim false_value As Integer

Dim strRetVal As String
Dim intgoodasc As Integer
strRetVal = ""   '// return value initialized to erro


'// Initialize True and False values
true_value = 1
false_value = 0
intgoodasc = true_value


***** ..\ACCESS\FMT_C39.ABC
'// ---------------------------------------------------------------- '//
Function fmt_c39 (strC39Str As String, strAscSet As String)

strRetVal = ""   '// return value initialized to error

Dim intGoodasc As Integer

*****

***** FMT_C39.VB
   Case "SHORT"
      intgoodasc = l_short(strC39Str)

***** ..\ACCESS\FMT_C39.ABC
   Case "SHORT"
      ll_goodasc = l_short(strC39Str)

*****

***** FMT_C39.VB
      strC39Str = spaceconvert(strC39Str)
                
***** ..\ACCESS\FMT_C39.ABC
      strC39Str = spaceconvert(strC39Str)
   
   Case "SHORT_WITH_CHECKDIGIT"
      ll_goodasc = l_short(strC39Str)

      '// calculate check digit
      strC39Str = c39CheckDigit(strC39Str)

      '// --- convert spaces to underscores
      strC39Str = spaceconvert(strC39Str)
                
*****

***** FMT_C39.VB
   Case "LONG"
      intgoodasc = l_long(strC39Str) '// long sets pass the parameter by
                                      '// reference because of special
***** ..\ACCESS\FMT_C39.ABC
   Case "LONG"
      ll_goodasc = l_long(strC39Str) '// long sets pass the parameter by
                                      '// reference because of special
*****

***** FMT_C39.VB
'// --- if the check of the string j rned out OK return true
If intgoodasc = true_value Then
   strRetVal = "*" + strC39Str + "*"
***** ..\ACCESS\FMT_C39.ABC
'// --- if the check of the string j rned out OK return true
If ll_goodasc = True Then
   strRetVal = "*" + strC39Str + "*"
*****

***** FMT_C39.VB
Dim intKounter As Integer  '// loop counter
intRetVal = 1
strStorage = ""
***** ..\ACCESS\FMT_C39.ABC
Dim intKounter As Integer  '// loop counter
intRetVal = True
strStorage = ""
*****

***** FMT_C39.VB
For intKounter = 1 To Len(strAscStr)
    strChar = Mid$(strAscStr, intKounter, 1)
    
    '// Validate and convert string character
    Select Case Asc(strChar)
       Case 0
***** ..\ACCESS\FMT_C39.ABC
For intKounter = 1 To Len(strAscStr)
    strChar = Mid(strAscStr, intKounter, 1)
 
    '// Validate and convert string character
     Select Case Asc(strChar)
       Case 0
*****

***** FMT_C39.VB
       Case 1 To 26
          strStorage = strStorage + "$" + Chr$(Asc(strChar) + 64)
       Case 27 To 31
          strStorage = strStorage + "%" + Chr$(Asc(strChar) + 38)
       Case 32
          strStorage = strStorage + "_"
       Case 33 To 44
          strStorage = strStorage + "/" + Chr$(Asc(strChar) + 32)
       Case 45 To 46
          strStorage = strStorage + strChar
       Case 47
***** ..\ACCESS\FMT_C39.ABC
       Case 1 To 26
          strStorage = strStorage + "$" + Chr(Asc(strChar) + 64)
       Case 27 To 31
          strStorage = strStorage + "%" + Chr(Asc(strChar) + 38)
       Case 32
             strStorage = strStorage + "_"
       Case 33 To 44
            strStorage = strStorage + "/" + Chr(Asc(strChar) + 32)
       Case 45 To 46
            strStorage = strStorage + strChar
       Case 47
*****

***** FMT_C39.VB
       Case 48 To 57
          strStorage = strStorage + strChar
       Case 58
***** ..\ACCESS\FMT_C39.ABC
       Case 48 To 57
            strStorage = strStorage + strChar
       Case 58
*****

***** FMT_C39.VB
       Case 59 To 63
          strStorage = strStorage + "%" + Chr$(Asc(strChar) + 11)
       Case 64
***** ..\ACCESS\FMT_C39.ABC
       Case 59 To 63
          strStorage = strStorage + "%" + Chr(Asc(strChar) + 11)
       Case 64
*****

***** FMT_C39.VB
       Case 91 To 95
          strStorage = strStorage + "%" + Chr$(Asc(strChar) - 16)
       Case 96
***** ..\ACCESS\FMT_C39.ABC
       Case 91 To 95
          strStorage = strStorage + "%" + Chr(Asc(strChar) - 16)
       Case 96
*****

***** FMT_C39.VB
       Case 97 To 122
          strStorage = strStorage + "+" + Chr$(Asc(strChar) - 32)
       Case 123 To 126
          strStorage = strStorage + "%" + Chr$(Asc(strChar) - 43)
       Case 127
***** ..\ACCESS\FMT_C39.ABC
       Case 97 To 122
          strStorage = strStorage + "+" + Chr(Asc(strChar) - 32)
       Case 123 To 126
          strStorage = strStorage + "%" + Chr(Asc(strChar) - 43)
       Case 127
*****

***** FMT_C39.VB
       Case 128 To 255
          intRetVal = 0
    End Select
***** ..\ACCESS\FMT_C39.ABC
       Case 128 To 255
          intRetVal = False
    End Select
*****

***** FMT_C39.VB


'// --- change parameter with converted string
***** ..\ACCESS\FMT_C39.ABC

'// --- change parameter with converted string
*****

***** FMT_C39.VB
'// in the 44 character set of Code 39
Function l_short (strAscStr As String) As Integer

***** ..\ACCESS\FMT_C39.ABC
'// in the 44 character set of Code 39
Function l_short (strAscStr As String)


*****

***** FMT_C39.VB
Dim intKounter As Integer
intRetVal = 1
 
***** ..\ACCESS\FMT_C39.ABC
Dim intKounter As Integer
intRetVal = True
 
*****

***** FMT_C39.VB
For intKounter = 1 To Len(strAscStr)
    
    '// Check to see if character is in 44 character ASCII set
    If InStr("ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 *-.$/+%", Mid$(strAscStr, intKounter, 1)) = 0 Then
       intRetVal = 0
    End If
***** ..\ACCESS\FMT_C39.ABC
For intKounter = 1 To Len(strAscStr)

    '// Check to see if character is in 44 character ASCII set
    If InStr("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%", Mid(strAscStr, intKounter, 1)) = 0 Then
       intRetVal = False
    End If
*****

***** FMT_C39.VB
'// The variables WILL be changed
Function spaceconvert (strToChange As String) As String
    Dim intKounter As Integer
***** ..\ACCESS\FMT_C39.ABC
'// The variables WILL be changed
Function spaceconvert (strToChange As String)
    Dim intKounter As Integer
*****

***** FMT_C39.VB
    For intKounter = 1 To Len(strToChange)
        strChar = Mid$(strToChange, intKounter, 1)
        
        '// if it is a space convert to underscore
           If strChar = " " Then
           strChar = "_"
***** ..\ACCESS\FMT_C39.ABC
    For intKounter = 1 To Len(strToChange)

        strChar = Mid(strToChange, intKounter, 1)

        '// if it is a space convert to underscore
        If strChar = " " Then
           strChar = "_"
*****

***** FMT_C39.VB
        strStorage = strStorage + strChar
   Next
    
    '// return value
    spaceconvert = strStorage
***** ..\ACCESS\FMT_C39.ABC
        strStorage = strStorage + strChar
    Next
    
    spaceconvert = strStorage
*****

***** FMT_C39.VB


***** ..\ACCESS\FMT_C39.ABC



'// This function returns a check digit for a code 39 string.
function c39CheckDigit (strC39String as string)
dim intKounter    as integer  '// Looping counter
dim c39Value      as integer  '// Numeric value of string
dim c39CheckDigit as string   '// The Check Digit
dim c39CharSet    as string   '// The c39 43 character set
dim strChar       as string   '// the current character

c39CharSet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%"

    For intKounter = 1 To Len(strToChange)
      strChar = Mid(strToChange, intKounter, 1)

      '// find the location of this character in the valid set of characters
      '// subtract 1 to make sure this because the character set values are
      '// 0 based
      c39Value = c39Value + (instr(c39CharSet, strChar) - 1)
    Next
    
    c39CheckDigit = mid$(c39CharSet, (c39Value mod 43) + 1,1)
return c39CheckDigit


*****


