“Syntax” Highlight a flatfile


I've googled and looked and explored, but it seems most editors configurable syntax highlighting definitions are based on keywords and such. I need one that is based on columns and lines, basically something to highlight different fields in a flat file.

It needs to be more complicated than one line fits all however, there are several different "types" of lines.

A sample is shown below

A9999000055555 333333     55554444422222210102009000000333333
C9999        0004

Except for "0004" (# of B records) and "10102009" (a date) all other sequential numbers would be actual alpha-numerics representing different user input fields. The first letter is usually designated as a Line type.

The intent of this question is to allow humans to verify the "correctness" of the files format. Typically these files are normally created in an automated way, but business rules change, and old mainframe programs have to be updated (and what ends up happening is not pretty). So the idea is to give those who create these files a way to double-check themselves that the file meets the format. I do not intend for ANY business rule verification here, purely format.

Best Answer

  • You could look at the RecordEditor RecordEditor it is not a Text editor (it displays the data in a table). It also has single record display + other views available.

    The default is to select the record layout but the there is a "prefered layout" which will display each record using the correct layout for the record.

    It does allow you to visually check the file

    With the RecordEditor you can display the file in a table (following with prefered option

    RecordEditor table display

    you can also display in a highlighted text view (View >>>> Text View (Highlight Fields))

    Text Editor View with highlighted fields

    you can also mix-match, here the current record is also displayed in table format on the right hand side:

    Text Editor View with highlighted fields and Single-Record View

    Alternatively the RecordEditor has macro option. You could

    1. Use the built in macros ViewForEachRecordType.js or HeaderDetailFooterTabs.js (missing from some versions) to display each record type on a seperate Tab
    2. Write your own (possibly adapted from ViewForEachRecordType.js)

    Running ViewForEachRecordType.js

    Running Macro

    This will generate a seperate Tab for each record type in the File:

    Output From ViewForEachRecordType.js

    Another possibility could be Textplorer, I have not tried it myself but it looks like it will highlight fields

  • Related Question