Module cCodeMaintOpen_Mixin.pkg

     1// Mixin class to support transistion support for CodeType and CodeMast files.
     2// These files used to be in filelist and they used to reside at 207 and 208 and they
     3// were always opened with "open as"
     4// We want these to be in the filelist at 253 and 254. These open methods will attempt to open these files
     5// as such. If these are old files (not in filelist or wrong number) they will get loaded with the old
     6// open as - thus keeping this backwards compatible.
     7// By adding to filelist, we can sort the files and we can open them as other database sources.
     8use VDFBase.pkg
     9
    10Declare_DataFile CodeType
    11Declare_DataFile CodeMast
    12Define C_Expected_CodeType_FileNumber for 253  // and the logical name must be CODETYPE
    13Define C_Expected_CodeMast_FileNumber for 254  // and the logical name must be CODEMAST
    14
    15{ Visibility=Private }
    16Class cCodeMaintOpen_Mixin is a Mixin
    17
    18    Procedure OpenCodeMast
    19        string sName
    20        If (Codemast.File_number=C_Expected_CodeMast_FileNumber) begin
    21            get_attribute DF_FILE_LOGICAL_NAME of Codemast.File_number to sName
    22            If (uppercase(trim(sName))="CODEMAST") begin
    23                Open CodeMast
    24                Procedure_return
    25            end
    26        end
    27        Open "CodeMast" as Codemast.File_number
    28    End_Procedure
    29
    30    Procedure OpenCodeType
    31        string sName
    32        If (Codetype.File_number=C_Expected_CodeType_FileNumber) begin
    33            get_attribute DF_FILE_LOGICAL_NAME of CodeType.File_number to sName
    34            If (uppercase(trim(sName))="CODETYPE") begin
    35                Open CodeType
    36                Procedure_return
    37            end
    38        end
    39        Open "CodeType" as CodeType.File_number
    40    End_Procedure
    41
    42End_Class
    43