问题
How do you Edit a (binary EBCDIC) Mainframe file in the RecordEditor with out a Cobol Copybook.
How do you generate Java code to read the file using the RecordEditor.
Note: This is an attempt to split a question that is far to broad to give meaningful answer to into a series of simpler Question and Answer's.
回答1:
Try and avoid editing a binary file with a Cobol Copybook if at all possible. This should only be attempted as a last resort !!!.
Try and get that Cobol copybook (or some field layout document) for the file !!!
Some general advise:
- It is feasible when dealing with 10 / 20 fields in a record but not if there a thousands of fields in a Record.
- Take your time do not rush the process. Try and get each step correct before moving on
- Finally upgrade to the latest version of the RecordEditor (currently 0.98.4)
- This process will also work for normal Text file as well
RecordEditor Layout Wizard
To start the wizard select option Record Layouts >>> Layout Wizard.
File Structure screen
The file structure screen has 3 purposes:
- Get the File structure - It could be Fixed Width, VB, Windows/Unix Text file
- Get the Record-Length (if it is a fixed width file).
- Get the font (character-set / encoding)
The RecordEditor will try and work this out for you
Field Selection Screen
The RecordEditor will try and work out where fields start and end but it is not perfect. You need to carefully check and correct its choices
On this screen, the fields are displayed in alternating colors
- you create/delete a field by clicking on
- use the Clear Fields button clear all the fields
- you can change what field-types to search for using the various check box's (e.g. Mainframe Zones Decimal)
- The Add Fields will do another field search
Field Definition screen
On this screen you define the field names and Types. You may need to go back to the **Field Selection Screen* to adjust the fields
Editing the file
Once the Record Layout
has been defined, it can be used on the open file screen
Generating Java code
When editing your file, you can generate java~JRecord code to read the file by selecting Generate >>> Java >>> ....
You can the enter a package-id + generate options:
and finally your sample java code is generated to read / write the file.
来源:https://stackoverflow.com/questions/45812354/edit-a-mainframe-file-in-the-recordeditor-without-a-copybook