In IBM Planning Analytics (TM1), TurboIntegrator (TI) processes are essential for automating data operations. One of the most useful functions in TI scripting is ASCIIOutputOpen, which allows you to open a file for writing ASCII data. Whether you need to create a new file or append data to an existing one, this function provides the flexibility to control file access and modifications efficiently.
Append or Overwrite: Choose whether to overwrite an existing file or add new data to the end.
Shared Read Access: Enable other processes or users to read the file while it’s being written.
Supports Multiple File Types: Works seamlessly with .csv and .txt files, making it ideal for various data export needs.
The basic syntax for ASCIIOutputOpen is:
ASCIIOutputOpen(FileName, OpeningMode);
FileName
The full path and filename (including extension) where data will be written.
Example: "C:\Data\Report.csv"
OpeningMode
A numeric code that determines how the file is accessed.
Mode |
Description |
Behaviour |
0 |
Overwrite without shared read access |
Creates or overwrites the file; no other process can read simultaneously. |
1 |
Append mode without shared read access |
Adds data to the end of the existing file; no sharing. |
2 |
Overwrite, shared read access enabled |
Overwrites if the file exists; allows other processes to read concurrently. |
3 |
Append, shared read access enabled |
Adds data to the end; allows other processes to read the file simultaneously. |
For more granular control, you can also use:
FILE_OPEN_APPEND() – Opens a file in append mode.
FILE_OPEN_SHARED() – Opens a file with shared read access.
Combining these functions can provide finer control over file operations.
Example 1: Overwriting a File with Shared Read Access
If you want to generate a new CSV report (overwriting any existing version) while allowing others to read it:
ASCIIOutputOpen("C:\\Reports\\SalesData.csv", 2);
Example 2: Appending Data with Shared Access
If you need to add new records to an existing file without locking it:
ASCIIOutputOpen("C:\\Reports\\SalesData.csv", 3);
ASCIIOutputOpen is a powerful function in TurboIntegrator that helps manage file exports efficiently. By understanding its different modes, you can ensure seamless data operations—whether you're generating reports, logging data, or integrating with external systems.
Pro Tip: Always verify file paths and permissions before running TI processes to avoid errors!
Have you used ASCIIOutputOpen in your projects? Share your experiences in the comments! 🚀