Function LoadDataFile

 

Function LoadDataFile( ByRef sFileName $ ) As Long

Purpose: Read ASPEN data file.

Works in:      OneLiner and Power Flow.

Parameters:     

sFileName    [in] Path name of the OLR or DXT file.

Return value:

0               Failure.

1               Success.

2               File read with data errors and/or warnings.

Remarks: The OneLiner’s TTY output during the data file reading operation execution is atomatically saved in the log file PowerScriptTTYLog.txt in the Windows %TEMP% folder. When this funtions return value is other than 1, you must check the content of this log file for details of data errors and warnings that were found when reading the file and proceed accordingly.

 

Example:

 

Sub main

  If 1 <> LoadDataFile( “SAMPLE30x.DXT" ) Then

    Print ErrorString()

    ChDir(GetWindowsEnvironmentVariable( "TEMP" ))

    sLogFile$ = "PowerScriptTTYLog.txt"

    Open sLogFile$ For Input As #1

    sTTYLog = ""

    While Not EOF(1)

      Input #1, sLine

      sTTYLog = sTTYLog & Chr(13) & Chr(10) & sLine

    Wend

    Print sTTYLog

  Else

    Print "Success"

  End If

End Sub