Library for parsing Clarion TPS files. Also contains a TPS to CSV converter.
(C) 2012-2021 E.Hooijmeijer, Apache 2 licensed
WARNING : This software is based on Reverse Engineered TPS Files. As such, its probably incomplete and may mis-interpret data. It is no replacement for any existing Clarion tooling. Check the output files thoroughly before proceeding.
Typical use: java -jar tps-to-csv.jar -s [source file or folder] -t [target file or folder]
Read the blogpost or this one about the encryption of TPS files.
Download the binary.
//
// Read the TPS file
//
TpsFile tpsFile = new TpsFile(new File("datafile.tps"));
//
// TPS files can contain multiple tables (commonly only one is used).
//
Map<Integer, TableDefinitionRecord> tables = tpsFile.getTableDefinitions(false);
for (Map.Entry<Integer, TableDefinitionRecord> entry : tables.entrySet()) {
TableDefinitionRecord table = entry.getValue();
//
// For each table get the field definition (columns).
//
for (FieldDefinitionRecord field : table.getFields()) {
// Do something with the field definition.
}
//
// And data records (rows).
//
for (DataRecord rec : tpsFile.getDataRecords(entry.getKey(), entry.getValue(), false)) {
// Do something with the data record.
}
}
Example for an encrypted TPS file:
TpsFile tpsFile = new TpsFile(new File("datafile.tps"), "password");
- improved performance on record to memo matching.
- key recovery work in progress utility classes.
- version number reporting.
- ignoreErrors writes available bytes of blobs with invalid length.
- Improved loading of the TPS file by allocating all memory in advance.
- TpsPage flushing, less memory is used at the expense of CPU.
- Added memory reporting when running with -verbose.
- Byte buffers are now shared instead of copied where possible.
- For TPS files with multiple tables, the name is now exposed in the CSV file name.
- Fixed a bug in array handling. Correct offset is now used.
- Added support for custom TPS string encodings such as CP850.
- Leading zero's of BCD values are now trimmed.
- Fixed a bug in BCD parsing. For some TPS files the 'bcdLengthOfElement' value exceeds the number of available (remaining) digits. The value is now ignored and the actual length of available digits is taken.
- Streaming Support for large files.
- Refactoring of TPS to CSV utility.
- removed sort option as its now implicit (use -direct to not sort).
- added verbose option to have some sense of progress on large files.
- Support for encrypted files.
- Support for Binary Memo's (aka BLOBs)
- Support for BCD fields
- Support for Array fields
- Expand Array fields into multiple CSV columns
- Move to Github
- Unit tests.
- Java doc.
- Fixed bug in page scanning, where a page was missed when the previous ended at a page boundary
- Added character -encoding support to render csv in specific encoding.
- Added -raw support to have the csv without any applied encodings.
- Added -compare to topscan generated csv file.
- Added -sort to sort the records to their row nr before outputting.
- Fixed bug in Block parsing, resulting in record duplication.
- Added support for parsing indexes.
- Added support for Table Name Records
- Added -layout option to display file layout.
- First Release