Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.5b

Application v 5.24b

  

 

Chapter Twenty-oneEDGARView Integration (continued)

EDGARArchiveOpen Function

Overview

The EDGARArchiveOpen function opens an EDGAR Archive or Return Copy file and creates an internal map of the file. Operation of this function can be somewhat time consuming, particularly if the source file is directly downloaded from the SEC EDGAR Archive.

Syntax/Parameters

Syntax

handle = EDGARArchiveOpen ( string source, [boolean bHeader] );

Parameters

source

A string containing the source filename and path. The string can specify a URI. If a local file is specified, it is held open until the archive object is closed.

bHeader

A boolean when set to non-zero, only the header and properties are loaded. The documents are not mapped and cannot be retrieved when this flag is set.

Return Value

A handle value or error as NULL_HANDLE (0). Use the GetLastError function to return details of the error if the object fails to open. Use GetLastErrorMessage to retrieve textual details. The handle is subsequently used to access the contents of the archive. When the handle is no longer needed, use the CloseHandle function to destroy the object.

If the source file contains structural errors, an ERROR_SYNTAX will be returned with one of the following codes in the lower word:

  0x1000 Unable to parse header (probably invalid archive).
  0x1001 Expected a <PDF> tag.
  0x1002 Syntax error in UU encoded section.
  0x1003 Expected a <DOCUMENT> tag. The error message will contain the location.
  0x1004 Premature end of file while loading document header.
  0x1005 Premature end of file while looking for document or file end tags.
  0x1006 Could not locate return copy file delimiter.
  0x1007 Bad parameter in document header of return copy.

 

The GetLastErrorMessage will contain additional information such as the offending line number in the source file. 

Remarks

Once open, the file properties and file content can be extracted from the EDGAR Archive.

The source file is opened with read share and held open as long as the object is open.

Related Functions

Platform Support

Go13, Go16, GoFiler Complete, GoFiler Corporate, GoFiler, GoFiler Lite, GoXBRL

Legato IDE, Legato Basic