Is there a Windows alternative to Mainframe FileAID? - amazon-web-services

For work, I'm on a team that is migrating a system from Mainframe to AWS. Part of the work I do is using FileAID to work on fixed-width files with custom layouts (here, if anyone is curious) What I'm wondering is, is there any sort of a desktop application that has similar file layout display features similar to FileAID?

Two Optioms
Microfocus Cobol has an editor
RecordEditor can display fixed width file.
RecordEditor
The RecordEditor can display Binary Mainframe or PC / Linux text files.
For File Description the RecordEditor can:
Use File Descriptions entered into it
Imported Cobol Copybooks
Cobol Copybooks directly (Single Record File types)
Xml File Descriptions
Entering filename and Cobol Copybook:
File Display:
Record Display:
Note: When first starting the RecordEditor make sure you select the schema and also the Cobol option
Related question
Binary Mainframe Cobol Files
RecordEditor Layout Wizard

CudaText editor (free, cross platform) has rich lexer engine, so it's easy to write a "lexer" which supports such formats.
For example, "Intel HEX" is a file format with fixed columns, and lexer "Intel HEX" is present in CudaText addons. It looks like this:
This lexer even highlights "wrong lines" with red.

Related

Importing Prophet Projection file into SAS

Our customer has provided us with a Prophet ".projection" file, which appears to be a binary file (lots of special characters when opening in notepad - ?Š…kÿd?Š…kÿd? ).
My question is - how can this file be imported into SAS? The file was generated from Prophet version 8.1 (PE). In Prophet 7.3 it was possible to use Readbin73 to do the binary->text conversion of the PRJs etc. Is there anything similar for 8.1?
Open the Prophet Workspace (.PRW) file to which your .projection file relates.
Click on Results & Runlogs in the sidebar and expand the option that says "ResultType: Projection".
In the upper left corner of the ribbon you will see two options:
"Copy Grid" allows you to copy the data to the clipboard, after
which you can paste the tab separated data in the programme of your
choice.
"Copy Grid to Excel" allows you to export the data
directly to Excel.
You can then prepare the data for SAS.
These steps work in Prophet 8.2.

Cross-platform way to get user friendly file type description

What's a cross-platform way for getting a user-friendly description of a file?
Examples:
foo.pdf -> "Portable Document Format (PDF)
bar.doc -> "Microsoft Word Document"
Pointers to libraries or appropriate system APIs would be highly appreciated.
A Qt/C++ solution is preferred but anything is fine.
Target platforms are Windows and Mac OS X. I'd prefer the descriptions to match what would be found in Explorer or Finder if possible (rather than maintaining a map of extensions -> descriptions myself).
The GNU File command is builtin for Linux and OSX, and there is a version available for Windows (http://gnuwin32.sourceforge.net/packages/file.htm).
File tests each argument in an attempt to classify it. There are three
sets of tests, performed in this order: filesystem tests, magic number
tests, and language tests. The first test that succeeds causes the
file type to be printed. The type printed will usually contain one of
the words text (the file contains only printing characters and a few
common control characters and is probably safe to read on an ASCII
terminal), executable (the file contains the result of compiling a
program in a form understandable to some UNIX kernel or another), or
data meaning anything else (data is usually `binary' or
non-printable). Exceptions are well-known file formats (core files,
tar archives) that are known to contain binary data.
You could invoke the file command using QProcess and display the returned info.
Output looks like :
$ file document.pdf
document.pdf: PDF document, version 1.5
$ file test.txt
test.txt: ASCII text, with CRLF, CR, LF line terminators
The closest that I think you can get out of Qt is QFileInfo.
Windows keeps track of the mapping through the registry that can be accessed through Qt's QSettings. But just from brief research it sounds like it might be kind tricky to mimic Explorer's mapping.
You can also launch the file with the default handler using QDesktopServices::openUrl().
I haven't researched how or where OSX keeps track of the file type description information.
Hope that helps.

Programmatically creating Excel file in C++

I have seen programs exporting to Excel in two different ways.
Opening Excel and entering data cell by cell (while it is running it looks like a macro at work)
Creating an Excel file on disk and writing the data to the file (like the Export feature in MS Access)
Number 1 is terribly slow and to me it is just plain aweful.
Number 2 is what I need to do. I'm guessing I need some sort of SDK so that I can create Excel files in C++.
Do I need different SDKs for .xls and .xlsx?
Where do I obtain these? (I've tried Googling it but the SDKs I've found looks like they do other things than providing an interface to create Excel files).
When it comes to the runtime, is MS Office a requirement on the PC that needs to create Excel files or do you get a redistributable DLL that you can deploy with your executable?
You can easily do that by means of the XML Excel format. Check the wikipedia about that:
http://en.wikipedia.org/wiki/Microsoft_Excel#XML_Spreadsheet
This format was introduced in Excel 2002, and it is an easy way to generate a XLS file.
You can also try working with XLS/XLSX files over ODBC or ADO drivers just like databases with a limited usage. You can use some templates if you need formatting or create the files from stratch. Of course you are limited by playing with the field values that way. For styling etc. you will need to use an Excel API like Microsoft's.
I'm doing this via Wt library's WTemplate
In short, I created the excel document I wanted in open office, and save-as excel 2003 (.xml) format.
I then loaded that in google-chrome to make it look pretty and copied it to the clipboard.
Now I'm painstakingly breaking it out into templates so that Wt can render a new file each time.

Convert .odt .doc .ods files to .txt files

I want to convert all the .odt .doc .xls .pdf files to .txt files.
I want to convert these files to text files using a shell script or a perl script
There's a program for odt files and alikes:
odt2txt - avaliable in repos.
$ unoconv --format=txt document1.odt
Should produce document1.txt.
OpenOffice has a built-in document converter capable of handling a bunch of formats- take a look at unoconv: http://dag.wieers.com/home-made/unoconv/
That being said, I have had some troubles getting that to work in the past- If you're having trouble, take a look at similar programs for AbiWord (another open source word processor).
For word documents, you can try antiword, at least on linux. It's a command line utility that takes a word document as an argument, and spits out the text from that document (as best as it can figure) to Standard Output. Maybe you can specify an ouput file too. I can't remember the details of how it works. I haven't used it in a while. Not sure if it can handle OO documents.
It's certainly possible to do this, though there is something strange and impenetrable about the OO project and its documentation that makes things like this hard to research and follow. However, OO has the capability to convert all of those types, not just the OO native ones, and it can do it via two different forms of automatic control.
These are the two general approaches.
You can start OO and tell it to execute a macro which does this job for you for a given file. You then just have to write the macro and a script to loop over your files. The syntax is something like
$ oowriter -headless filename macro://dir/Standard.Module1.sMySub
The other thing OO has is a network API. This is based on something called UNO.
$ oowriter -accept=accept-string
Notifies the OpenOffice.org software that upon the creation of
"UNO Acceptor Threads", a "UNO Accept String" will be used.
You will need some sort of client library. I think they have one for Python at least. Using this technology a Python program or some other scripting language with an OO client library could drive the program and convert all the files. Since OO reads MSO, it should be able to do all of them.
Open the file in LibreOffice. Click on "File", "Save-as" scroll down to find the text option. Click that and it will be saved as a text file.
FYI, I had an *.ODT file that was 339.2 KB in size. When I save-as text the size of the file shrunk to ONLY 5.0 KB. Another reason for saving your files as text files.
For the Microsoft formats, look into the wvWare tools.
Open .ods file normally in libre office
Highlight text to be converted
Open a terminal
Run vi
Press "i" to get insert mode
Press ctrl-shift-v
Done!
Need some formatting?
Save the file as
Get out of vi
Run:
$cat | column >filename2
This worked in opensuse running KDE
Substitute "kwrite" for "vi", if you want

How to add properties to a file like the Windows Office documents?

How to add properties to a file like the Windows Office?
In Windows, is possible to edit fields from a file like Title, Subject, Keywords etc. How to do the same with an arbitrary file from C/C++ without using Office?
Do you have any hint about API, DLLs or general tricks?
This data can be stored in alternate data streams. Here are some examples of the APIs to access ADSs in NTFS.
There are two kinds of metadata that might be displayed. One is file based metadata, which is going to specific to NTFS, in which case you should research NTFS metadata API's. The other kind of metadata is going to be file format specific, like JPEG exif blocks, or MS Office Summary. This kind of metadata is going to require specific knowledge of every kind of file format you want to edit data for, and in the case of Microsoft Office documents, is liable to change between office versions. You're best bet for office documents would probably be to start with OOXML summary field editing and seeing if you want to continue with other formats from there.