Sub doHMIOpenFile(BaseName As String, Mode As String) 'Create or switch to a different logging file. BaseName may include an extension
Dim S As String
Dim N, M, K As Int
If IsNumber(Mode) Then
M = Bit.And(Mode, 3) 'AND to protect against silly users
Else
M = -1
End If
If BaseName <> "" Then 'Caller gave a name
K = GetFCB(BaseName) 'Find out if it already has an FCB
If (K = -1) AND (M <> -1 Then) 'No FCB, Mode is specified ... create FCB
N = CreateFCB(BaseName, M) 'CreateFCB takes care of errors and messages
If N >= 0 Then
CurrentFCB = N
End If
Else
CurrentFCB = K
End If
Else
End If
End Sub