Cobol Products
  
Home
Download
Buy
About
Contact Us
 

Cobol Tools Index
Data Viewer Index
Introduction
Features and Trial
Buy DataViewer
DataViewer Manual
Data Conversion Service
Contact Us

 
Cobol DataViewer: Manual

How To Use Data-Viewer

This is a "How-To" Data-Viewer Manual where we tell you how to achieve your project goals using Data-Viewer.

Start: Open Data File. Select File. Open. Browse for data file that you want to open and click OK. Data-Viewer will guess record layout of this data file and open it. Even if you have record layout in a copybook, you should start with this step.

Load Record Layout from Cobol Copybook. If you have a record layout for this data file in a Cobol copybook (Cobol equivalent of C include file) then load this layout into Data-Viewer by selecting "File. Load Layout from Copybook".

In the dialog that appears specify the copybook name (click "..." to browse for it) and click Go. Data-Viewer will run CBL2FDD tool that will convert this copybook to an *.FDD file that stores file parameters and record layout for use by Data-Viewer and other Data Readers.

Check the parsing results for syntax errors and correct them. If copybook is parsed correctly, click the Apply button and parsed record layout will be applied to the currently loaded data file.

Copybook is a text file in Cobol that looks like this:

01 out-rec. 05 out-key pic 9(9) binary. 05 out-s-comp-3 pic s9(9) comp-3. 05 out-s-comp-5 pic s9(9) comp-5. 05 out-comp-5 pic 9(11) comp-5. 05 out-comp-3 pic 9(9) comp-3. 05 out-s-binary pic s9(9) binary. 05 fs-d-result pic 9(9).99 display. 05 fs-result pic 9(9)v99 display. 05 fs-result-breakdown redefines fs-result. 10 fs-result-int-part pic 9(9). 10 fs-result-fract-part pic 99. 05 fs-display pic x(8). 05 out-key-al pic 9(12) sync binary. Copybook must start with a 01 data item definition. It cannot start with an FD statement. Copybooks file names usually have extensions CPY, CBL, COB, but actually any extension can be used or no extension at all.

CBL2FDD generates this proxy main program that includes your copybook by reference. Then it parses this complete Cobol program and extracts record descriptor from it. Your copybook together with this program must form a syntactically correct Cobol program. CBL2FDD can also parse complete Cobol programs (not just copybooks).

IDENTIFICATION DIVISION. PROGRAM-ID. DUMMYPRG. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT file-name ASSIGN TO data-file-path ORGANIZATION IS organization DATA DIVISION. FILE SECTION. FD file-name. COPY "copybook-file-name". PROCEDURE DIVISION. 100-start.

Load Record Layout from Cobol Program. If in the Cbl2Fdd dialog you uncheck the "Input File is Copybook" box then Cbl2Fdd will parse a complete Cobol program and it will produce FDD files for all files that are read or written in this porgram.

Use Data File Indices to Order Records. By default Data-Viewer shows records in physical order. To make it read records in the order of an index, click File. Select Index, select one of the offered indices and click OK. Data-Viewer will read records in the order of the selected index. Index fields will be highlighted in green.

View Data Fields as Text and/or Hex Dump.
Select View. As Hex to show file data in Hexadecimal format.
Select View. As Text to show file data in ASCII text format.

Show/Hide Field Margins.
Select View. Show Field Margins to indicate where the field value ends by a "|" character.

Edit Record Layout. Use command in the Data menu (they also appear as button on the right) to edit the record layout of the loaded Cobol data file. See the "Editing Commands" Chapter below for details. Click the "Apply" button to cause reloading of the data file using the new layout.

Save Record Layout. Once your Cobol data looks good, it is time to save the edited record layout. Select "File. Save Layout As..." and specify the name of the *.FDD file to which layout is saved. The best approach is to have the layout file name the same as data file name but with a different suffix "FDD".

Load File using Saved Record Layout. When you need to open a data file using saved layout, open the *.FDD file that you saved not the data file. If you try to open a data file for which you have an FDD file, Data-Viewer will offer to offer the file using the saved FD layout instead.

Export (Convert) Data to External Formats. Select "File. Export Data" and specify the name of the output file (click "..." to browse for the file). Click the "Export" to start the export process.

You can set these options when exporting:
- Number of records to export.
- Field separator character (comma by default).
- Trim Text Data option.
- Option to Add field names as a first line of the exported file.

Data2Flat: Fast Converter to Flat (CSV) files. Data-Viewer also provides a GUI interface to our fast command-line converter Data2Flat. Invoke it using "Data2Flat: Fast File Converter". You can save the command line that start this converter and use it in a batch.

Data2Flat converts Cobol data file to flat (comma-separated values) data file. In the resulting flat file every record occupies exactly one line and data items on the line are separated by separator character (usually comma). Flat file contains text representation of all data items in a file. Flat files can be used to load data into Microsoft Excel and into most modern databases.

Data2Dbf: Fast Converter to dBase IV DBF files. Data-Viewer also provides a GUI interface to our fast command-line converters Data2Dbf. Invoke it using "Data2Dbf: Fast File Converter".

Data2Dbf converts Cobol data file to dBase IV DBF file. You can import DBF files into Microsoft Excel, Microsoft Access and other spreadsheet, reporting, and database software.

Filter Records.
Allows to set a filter to see only records that satisfy a user-defined condition. Used when working with files that contain records with different layouts (records created with REDEFINES in copybook). Select Data. Filter, click Use Filter and specify a condition in which a field is compared to a constant. Only the records that satify this condition will be shown.


Questions? Call +1-877-762-6367 (int. +1-703-218-1851)

Editing Record Layout in Data-Viewer

In this Chapter we dive into details of editing the record layout.

* View and Edit Field Properties.
Once data file is open, you can view and edit all properties of any of fields. When you select the field by clicking its name, the properties of this field are put into mini-windows below field name and you can edit these properties there. The following properties are available:
- offset in bytes,
- length in bytes,
- position of decimal point (comma),
- picture,
- usage,
- sign.
If you want to see offset, length and usage of all fields at once, select View. Record Layout.

* Apply Changes.
If you hit Apply button, the data file will be re-read using the changed field properties.

* Undo Changes.
If you hit Undo button, the latest set of changes to file layout will be undone. Undo can be hit several times, so the entire sequence of changes since the original load can be undone.

* Layout Manipulation Commands.
Copy. Create a copy of the selected field, add it after selected field.
Delete. Delete the selected field.
Merge. Merge the selected field with a field that comes after it.
Split. Split the selected field into two fields.

Single Field Guess.
If you click Guess button (or select "Data. Guess Field"), the selected field will be data-guessed based on its new length and offset, that is its usage, picture and sign will be computed, but not the lenght and offset. Use this command to data-guess fields whose length and/or offset were manually changed.

Compute Picture.
If you click Picture button (or select "Data. Compute Picture"), the Picture property will be computed for the selected field to reflect its changed length. Use this command to correct pictures of fields whose length and/or offset were manually changed.
Questions? Call +1-877-762-6367 (int. +1-703-218-1851)

Data2Flat and Data2Dbf options

These are Data2Flat and Data2Dbf command line options:

*** Data2Flat *** -help=boolean (now: -OFF-, can be -help or -no-help) Print help -progress=boolean (now: -OFF-, can be -progress or -no-progress) Show conversion progress -show-descr=boolean (now: -OFF-, can be -show-descr or -no-show-descr) Show the loaded FDD and RDD descriptor info -out-file=string (now: "") Output file name -separator=string (now: ",") String used to separate data fields -quote=string (now: "") Character used to quote character data -max-recs=number (now: 0) Number of records to convert (0=all) -dump-items=string list (now: ) List of fields to be dumped in the format from -group-format -dump-format=hex|alpha (now: hex) Format to be used for data items dump -trim=string list (now: "+ALL") Fields to be trimmed: ALL | ALLTEXT | ALLNUM | field-list -first-line-names=boolean (now: -OFF-, can be -first-line-names or -no-first-line-names) Export field names to first line of FLAT file -filter=string list (now: ) Filter expresion - refer to the documentation -europe-date=boolean (now: -OFF-, can be -europe-date or -no-europe-date) Print dates in DD.MM.YYYY form, rather than MM/DD/YYYY *** Data2Dbf *** -help=boolean (now: -OFF-, can be -help or -no-help) Print help -v=boolean (now: -OFF-, can be -v or -no-v) Print version -progress=boolean (now: -OFF-, can be -progress or -no-progress) Show conversion progress -show-descr=boolean (now: -OFF-, can be -show-descr or -no-show-descr) Show the loaded FDD and RDD descriptor info -log=boolean (now: -OFF-, can be -log or -no-log) Enable logging -memos=string list (now: ) List of fields to be converted to MEMOs (+ALL means all text fields) -out-file=string (now: "") Output file name Filter Specification in -filter. User may specify filter as follows: -filter=field-name-1,oper-1,value-1,field-name-2,oper-2,value-2 All these expressions will be ANDed. Operations available (CS stands for case-sensitive): non CS | CS | meaning -------+-----+------------- eq :eq == ne :ne != gt :gt > lt :lt < le :le <= ge :ge >= Currently there is a limitation of 2 fields in a filter.
Questions? Call +1-877-762-6367 (int. +1-703-218-1851)

Advanced Record Layout Issues

Here we describe format of the FDD/RDD file that encodes record layout. Most of the time you do not need to know details of the FDD/RDD file format and the file is encrypted anyway in the Trial version. However advanced users will find this Reference document useful.

OCCURS issues

Data item: name OCCURS n TIMES PIC p USAGE u is presented both:
- as n items with names name_1, name_2, ..., name_n, each having "PIC p USAGE u" format,
- as a concatenation of n items that has "PIC p(n) USAGE u" format, the group item is commented out in RDD file, though, but you can uncomment it if need be

File Descriptor (FDD) FDD file format

This document describes format of FDD file. FDD file describes the Cobol data file. It contains all data that is needed to read the file. FDD file usually has *.FDD extension. FDD file format is simple and it is easily readable by computer programs. FDD file consists of lines. Line can be of any length. There is no line continuation character, so lines cannot be broken. Lines that start with '#' or '*' or '/' are comment lines and as such they are ignored. Non-comment lines consist of fields. Fields are separated by one or more spaces (' ') or TABs ('\t'). Each field consists of non-space characters. First field of a line is a keyword that defines the interpretation of the remainder of the line. Every keyword starts a command. All commands take exactly one line. The following commands are available: * FILE <cobol-file-name> Specifies file-name as it appears in the Cobol program in FD and SELECT statements. This is here for informational purposes only. * RDDFILE <file-name> Specifies name of the RDD file that describes structure of the file record. If <file-name> contains spaces or special characters, it must be enclosed in single or double quotes. If <file-name> is not absolute, then it is relative to the directory of FDD file that contains this RDDFILE command. You may have several RDD files defined for one data record. * DATAFILE <file-name> Specifies name of the Cobol data file that contains the actual data. If <file-name> contains spaces or special characters, it must be enclosed in single or double quotes. If <file-name> is not absolute, then it is relative to the directory of FDD file that contains this DATAFILE command. Exactly one DATAFILE command must be present. * ORGANIZATION <org-type> Specifies data file organization. <org-type> can be one of the following: SEQUENTIAL ORGANIZATION IS SEQUENTIAL LINESEQUENTIAL ORGANIZATION IS LINE SEQUENTIAL BINARYSEQUENTIAL ORGANIZATION IS BINARY SEQUENTIAL INDEXED ORGANIZATION IS INDEXED RELATIVE ORGANIZATION IS RELATIVE * ACCESSMODE <am-type> Specifies data file access mode. <am-type> can be one of the following: SEQUENTIAL ACCESS MODE IS SEQUENTIAL DYNAMIC ACCESS MODE IS DYNAMIC RANDOM ACCESS MODE IS RANDOM * FILEFORMAT <format-type> Specifies vendor-specific physical format of the data file. The following phycal formats are available: DEFAULTFILEFORMAT default format for the program that uses FDD file. If no file format is specified, then DEFAULTFILEFORMAT is assumed. FSC Fujitsu data file MF Micro Focus data file ACU AcuCobol data file RM Ryan McFarland data file MFSCO Micro Focus on SCO UNIX data file. Create FDD/RDD files for SCO using -lang=mf and then manually change MF to MFSCO in FDD file.

Record Descriptor (RDD) file format

This document describes format of RDD file. RDD file describes the exact format of the Cobol data record (01 or FD record description). RDD file usually has *.RDD extension but it can be inlined in FDD file. RDD file format is simple and it is easily readable by computer programs. RDD file consists of lines. Line can be of any length. There is no line continuation character, so lines cannot be broken. Lines that start with "#" or "*" or "/" are comment lines and as such they are ignored. Non-comment lines consist of fields. Fields are separated by one or more spaces (" ") or TABs ("\t"). Each field consists of non-space characters. If a particular field has no value (is empty), it is represented by "@" character. First field of a line is a keyword that defines the interpretation of the remainder of the line. The following line types are available: * DATA line defines data item. This is the most popular line in RDD file. DATA <log-level> <phys-level> <name> <category> <usage> <sign> <occurs-from> <occurs-to> <offset> <bit-offset> <length> <picture> [<date-picture>] (all these <> items appear on one line in RDD file) <log-level> is logical level of the item in the hierarchy of data items. Starts at 0 and is incremented by 1. Can be 0, 1, 2, 3, 4, ... <phys-level> is physical level of the item as specified in the Cobol program. Has exactly 2 numeric decimal characters. Can be: 01, 02, ..., 05, 06, ..., 10, ..., 49. <name> is the name of the data item. Conforms to Cobol rules for user-defined names. If name is empty (@ character), then this is FILLER data item. <category> is effective category of the data item. It can have on the following values: G group item I index P pointer PP procedure pointer A alphabetic N numeric AN alphanumeric AE alphanumeric edited NE numeric edited IF internal float EF external float B bit J national (usually Japanese) JE national edited <usage> is effective USAGE clause of the data item. Effective usage means: If this item has no usage clause, then the usage clause of the nearest ancestor of the data item is used. If none of ancestors has usage clause, then USAGE DISPLAY is used. Usage can be one of the following: D or DF DISPLAY by Fujitsu DM DISPLAY by MicroFocus DR DISPLAY by RyanMcFarland and AcuCobol D1 DISPLAY-1 (DBCS) DW DISPLAY-WS CR RM COMP or ACU COMP-2: DISPLAY-like (display items differ in SIGN SEPARATE rpresentation) C BINARY or COMP 0 COMP-0: same as COMP, used in MS 1R COMP-1 by RM and ACU: variation of BINARY 4 COMP-4: same as BINARY 5 COMP-5: variation of BINARY) 6R COMP-6: RM binary X COMP-X: variation of BINARY) PD COMP-3 or PACKED-DECIMAL 3A COMP-3: variation by ACU 1 COMP-1: internal single float 2 COMP-2: internal double float I INDEX PT POINTER PP PROCEDURE-POINTER B BIT (FSC) On DM, DJ and DR: D (generic DISPLAY) will work in place of DM, DJ, and DR most of the time and you do not need to specify DM, DJ or DR. However, if you link fields in Data2Cr, then the actual DM, DJ or DR specifiers must be used. cbl2fdd generates these specifiers based on the value of -lang option. <sign> is effective SIGN clause of the data item. It can be one of the following: L SIGN IS LEADING LS SIGN IS LEADING SEPARATE LE EBCDIC sign LEADING T SIGN IS TRAILING TS SIGN IS TRAILING SEPARATE TE EBCDIC sign TRAILING @ no sign clause <occurs-from> <occurs-to> describes the OCCURS clause of the data item: @ @ no OCCURS clause <n1> @ OCCURS <n1> TIMES <n1> <n2> OCCURS <n1> TO <n2> TIMES DEPENDING ON ... <offset> is decimal number that encodes byte offset of this data item from the start of the record. Can be 0, 1, 2, and up. <bit-offset> is decimal number that encodes bit offset of this data item from the start of the byte designated in <offset>. Can be not 0 only for BIT items. Thus <full-bit-offset> = <offset>*8 + <bit-offset>. <length> is decimal number that encodes length of this data item in bytes. For BIT items <length> is is also in bytes. The length of BIT item in bits is equal to the length of unrolled picture string of the item. <picture> is PICTURE clause character string. <date-picture>, if it is present, tells the systems that this data item contains date and/or time and it gives the format of date/time presentation. Using this format, the system parses the date/time data item and stores it internally as a date/time item, so that at output time date/time-specific formatting can be applied to this data item. <date-picture> can be present only in numeric and numeric-edited data items. The number that represents date/time is parsed by the system according to the format specified in <date-picture>. <date-picture> can contain the following substrings: YY 2-digit year YYYY 4-digit year MM 2-digit month: " 1", "01", " 2", "02", ..., "11", "12" DD 2-digit day: " 1", "01", " 2", "02", ..., "30", "31" HH 2-digit hour: "00", " 0", " ", " 1", "01", ..., "23" NN 2-digit minute: "00", "01", ..., "59" SS 2-digit second: "00", "01", ..., "59" B Unused position All characters used for separating different time components ("/" ":" "," ".") are removed from the the data item before analyzing it using this template. That is, if you have numeric-edited data item which stores date time as "98/12/31 23:59:59", then it is turned into numeric data item 981231235959 you should use <date-picture> YYMMDDHHNNSS to recognize this number as date-time. * DECIMALPOINT line defines a character used to represent decimal point for numeric edited data items. DECIMALPOINT <COMMA | PERIOD> If this line is omitted, "DECIMALPOINT PERIOD" assumed. * CURRENCYCHAR line defines a character used as currency symbol. CURRENCYCHAR <char> If this line id omitted, CURRENCYCHAR "$" assumed. * ALPHABET line defines alphabet used for file. It may be EBCDIC or ASCII. If this line is ommitted, assumed alphabet is ASCII. * APPLIED_TO may be optionally specified in ALPHABET line after alphabet definition. Valid values are ALL and DISPLAY_ONLY. If "APPLIED_TO ALL" specified, all data read from file should be converted from file alphabet (some compilers like MicroFocus allow CODE-SET keyword for non-DISPLAY data items). "APPLIED_TO DISPLAY_ONLY" (the default) means that alphabet conversion must be applied to data items whose usage is DISPLAY. * RECORDLENGTH line defines fixed (minimal) record length. RECORDLENGTH <nReclen> <nReclen> is fixed record length. * MAXRECORDLENGTH line defines maximal record length. Maximal record length is more than fixed record length in case of variable record length (OCCURS..DEPENDING ON present in record definition). MAXRECORDLENGTH <nMaxreclen> <nMaxreclen> is maximal record length. Real record length lies between nReclen and nMaxreclen.

Frequently Asked Questions

Q: What files can be data-guessed?
A: All supported indexed and relative file formats are data-guessed. For sequential file we will ask you record length. Record length can be guessed too, but it will take several minutes of processor time and Data-Viewer still can make a mistake for multiple-layout files.

Q: What if I have REDEFINES and RENAMES clauses in data items in my FD?
A: We still can read and interpret your file correctly. All overlaid data items listed in REDEFINES and RENAMES clauses will appear in Record Descriptor Data (RDD) file and contents of the record will be interpreted using each of overlaid data items.

Q: What if I have OCCURS clause in data items in my FD?
A: We still can read and interpret your file correctly. The default behavior of cbl2fdd is to generate one data item descriptor for each occurrence of table data item.

You change this behavior by using -no-expand-tables option. In this case cbl2fdd generates only one data item for the first element of the table.

Q: I run cbl2fdd on my program but RDD and FDD files are not created. What went wrong?
A: Your program must be syntactically correct and it must contain both SELECT and FD statements for a file that are you are getting descriptors for. That is, if you have syntax errors because you did not specify the correct dialect to cbl2fdd, or copybooks are missing, you will not get FDD/RDD files for the file descriptors that were not fully understood by cbl2fdd.

Q: Can I manually remove data items from RDD file?
A: Yes, you can. If you remove a line that describes a data filed, you will not be able to access this data field. Do not remove lines that specify record length.

Siber Systems
Copyright © 1997-2010 by Siber Systems Inc.