COBOL (Common Business-Oriented Language) has been the backbone of enterprise computing for decades. COBOL applications use various file formats including sequential, indexed (ISAM), and relative files.
What You Can Upload
- Sequential files with COBOL copybook definitions
- Fixed-length records (RECFM=F, FB)
- Variable-length records (RECFM=V, VB), including their record descriptor words, whether the records are all one length or differ (an OCCURS DEPENDING ON table, or record types of different lengths), and the little-endian descriptors some tools write
- Spanned records (RECFM=VS, VBS), reassembled from their segments
- VSAM datasets (KSDS, ESDS, RRDS) unloaded to a flat sequential file with IDCAMS REPRO. A raw VSAM cluster cannot be copied off the mainframe as a file; REPRO is the standard way to get one out, and its output is what to upload
- ISAM and relative files, likewise once unloaded to a sequential file
- ZIP archive with data files and copybooks
What You Get Out
DataMeans converts your data into multiple modern formats:
| Output | Description |
|---|---|
csv/{TableName}.csv | One CSV file per table with all row data |
xlsx/{TableName}.xlsx | Excel workbook per table (omitted for tables over 1,048,575 rows, 16,384 columns or 8,000,000 cells - see note below) |
xls/{TableName}.xls | Legacy Excel format per table (omitted for tables over 65,535 rows, 256 columns or 150,000 cells - see note below) |
json/{TableName}.json | JSON array of records per table |
json/{TableName}.jsonl | Newline-delimited JSON (streaming-friendly) |
postgres.sql | PostgreSQL CREATE TABLE + INSERT statements |
mysql.sql | The same schema and rows, in MySQL dialect |
sqlite.sql | The same schema and rows, in SQLite dialect |
ansi.sql | The same schema and rows, in portable ANSI SQL |
sqlserver.sql | The same schema and rows, in SQL Server (T-SQL) dialect |
report.json | Structured conversion report |
report.md | Human-readable conversion summary |
How to Export / Obtain Files
-
Identify your COBOL data files on the mainframe/server
-
If the data is in a VSAM cluster, unload it to a flat sequential file first:
//UNLOAD EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //SYSIN DD * REPRO INDATASET(YOUR.VSAM.CLUSTER) OUTDATASET(YOUR.FLAT.FILE) /* -
Export or FTP the binary data files. Use binary mode: an ASCII-mode transfer corrupts packed decimal (COMP-3) and binary (COMP) fields
-
If the dataset is variable-length (RECFM=V, VB or VBS), issue
SITE RDWbefore the transfer. FTP discards record descriptor words by default, and without them the record boundaries are gone -
Locate corresponding copybook definitions (
.cpy,.cobfiles) -
Create a ZIP with data files and copybooks together
-
Upload the ZIP to DataMeans
You do not need to convert the copybook to ASCII first. A copybook transferred in binary mode is still EBCDIC, and DataMeans reads it either way.
Supported Features
- Copybook parsing for field definitions
- Every numeric storage form: zoned DISPLAY, COMP / BINARY, COMP-5, COMP-X and COMP-3 (packed decimal)
- Implied decimal points (
V) and scaling positions (P) in all of them, soPIC S9(3)V99 COMPholds 305.03 andPIC 9(5)PPPholds 30503000 - Signs: overpunched on the last or first digit, and separate
+/-characters (SIGN IS LEADING,SIGN IS TRAILING SEPARATE) - Numeric-edited pictures (
ZZ,ZZ9.99-,$$,$$9.99CR,+9(6)V99) read as the numbers they show - COMP-1 / COMP-2 floating point, in both IBM hexadecimal and IEEE 754 formats
- REDEFINES: every alternate layout of the same bytes (a record of another type, a date as its parts, a number as its text) is read as extra columns beside the first, and the record is as long as the longest of them
- OCCURS clause (array) normalization
- SYNCHRONIZED (SYNC) items, including the slack bytes the compiler inserts
- OCCURS DEPENDING ON variable-length tables, resolved per record, whether the records are packed to their count, padded out to the table's full size, or carry record descriptors
- Automatic EBCDIC to ASCII conversion
- Numeric precision preservation: a value too long for a floating-point number (more than 15 digits) is kept exactly, as its digits
Known Limitations
- Copybook definitions required for accurate field interpretation
- A REDEFINES column holds the same bytes read that way, so it means something only for the records it applies to (use the field that says the record's type to pick them); a number read from bytes that are not one is left empty, and is not reported. The report lists the alternate layouts it read
- A copybook with several 01-level records (one per record type) is read from the first only; the report names the others. Put the layouts under one 01 with REDEFINES to read them all
- Complex nested REDEFINES may require manual review
- One OCCURS DEPENDING ON table per record. Its count field must be stored before the table it sizes. Columns are produced for the declared maximum number of occurrences, so records with fewer leave the extra columns empty
- A numeric field that holds something other than a number (letters in a zoned
field, a packed field with a bad digit) is left empty, and the report names the
field and the first record with one. A field of spaces is an empty value, not
a zero, unless its picture says
BLANK WHEN ZERO - COMP-5 is written in the machine's own byte order, and the file does not say which. It is read big-endian, as a mainframe writes it. A file from Micro Focus or GnuCOBOL on an Intel machine is little-endian: for an ASCII file the report says which order was used, and if it is the wrong one, tell us and we will re-run it
- An edited picture with a
B,0or/(a date such as99/99/9999) is text, not a number, and stays text. Binary fields of more than 18 digits are not read - COMP-1 / COMP-2 fields carry no marker saying which float format they use, so
it is inferred from the file's character encoding: EBCDIC data is read as IBM
hexadecimal floating point, ASCII data as IEEE 754. The report states which
was used. If your program was compiled
FLOAT(IEEE)on the mainframe, tell us and we will re-run it
Troubleshooting
| Issue | Solution |
|---|---|
| Fields misaligned | Verify copybook matches data file layout |
| "No COPYBOOK schema files found" | Confirm the copybook is in the upload. EBCDIC copybooks are read as-is, so this means the file is missing or is not a copybook |
| Garbled characters | Check EBCDIC vs ASCII encoding settings |
| Numeric errors | Confirm COMP-3 vs DISPLAY field types. If some values are empty, report.md lists each field that held something that was not a number, with the first record |
| Float values off by a large factor | Check the float format line in report.md. A mainframe file read as ASCII gets IEEE 754 instead of IBM hexadecimal |
Note on the Excel formats. An
.xlsxsheet holds at most 1,048,575 rows of data and 16,384 columns, and a legacy.xlssheet 65,535 rows and 256 columns. Rather than ship a file that looks complete but is silently cut short, DataMeans leaves a table out of any Excel format it does not fit and notes it in the job report. The.xlsxcopy is also left out for tables of more than 8,000,000 cells (1,048,575 rows of 12 columns is 12.6 million), which take too long and too much memory to write, and the.xlscopy for tables of more than 150,000 cells, which the legacy format takes far too long to write. The CSV, JSON and SQL outputs always contain every row.
Overview
COBOL (Common Business-Oriented Language) defines file organizations and data structures for business data processing, supporting sequential, indexed, and relative file access methods. COBOL data files use record-based structures with hierarchical field definitions, designed for batch processing and transaction systems in mainframe and enterprise environments. Unlike modern databases, COBOL files emphasize fixed-length records and efficient sequential processing.
History and Background
- 1959: CODASYL committee begins COBOL development.
- 1960: COBOL 60 first specification released.
- 1961: COBOL 61 revision addresses flaws in the original specification.
- 1963: COBOL-61 Extended adds the sort and Report Writer facilities.
- 1965: COBOL, Edition 1965 adds mass storage file handling and table facilities.
- 1968: First ANSI COBOL standard (COBOL 68, ANSI X3.23-1968).
- 1974: COBOL 74 adds indexed and relative file organizations, the DELETE statement, and the segmentation module.
- 1985: COBOL 85 adds structured programming features: scope terminators, EVALUATE, inline PERFORM, and nested subprograms.
- 1989: ANSI X3.23a-1989 amendment adds the intrinsic function module.
- 2002: COBOL 2002 (ISO/IEC 1989:2002) adds object orientation, Unicode support, and bit/Boolean data types.
- 2014: COBOL 2014 adds IEEE 754 arithmetic data types, dynamic-capacity tables, and method overloading.
- 2023: COBOL 2023 adds transaction processing (COMMIT/ROLLBACK), asynchronous messaging (SEND/RECEIVE), and the LINE SEQUENTIAL file organization.
File Format Specifications
COBOL defines three primary file organizations implemented through various access methods.
File Organizations:
- Sequential: Records stored in order written, accessed sequentially.
- Indexed: Key-based access with ISAM-like indexing.
- Relative: Direct access by record number (RRDS-like).
- Line Sequential: Text-line records delimited by line terminators - a line feed (hex
0A) on UNIX-type GnuCOBOL builds, carriage-return/line-feed on native Windows; standardized in COBOL 2023.
File Extensions:
- No standard extensions - platform-dependent
- Mainframe: z/OS datasets use dataset names without file extensions
- PC compilers: commonly
.datfor data, with a separate.idxindex file for Micro Focus indexed files
File Structure:
- Records: Fixed or variable-length data structures; z/OS QSAM recording modes are F (fixed), V (variable), U (one record per block), and S (spanned)
- Descriptors: Recording mode V prefixes each record with a 4-byte record-length field and each block with a 4-byte block descriptor; mode S records span blocks, with a segment descriptor on each segment
- Fields: Defined by PICTURE clauses and hierarchical levels
- Keys: Primary and alternate record keys for indexed files; VSAM limits key length to 255 bytes
- Headers: Implementation-specific; e.g., GnuCOBOL relative files prefix each fixed-length record with a 4-byte header holding the record's data length
- Limits: QSAM records hold up to 32,760 bytes; block size may reach 2,147,483,647 bytes with large block interface support (DFSMS 2.10 or later)
Data Types and Structures
COBOL data types are defined by PICTURE (PIC) clauses rather than explicit type names:
| PIC Clause | Type | Description | Example |
|---|---|---|---|
| PIC 9 | Numeric | Digits only | PIC 9(5) - 5-digit number |
| PIC X | Alphanumeric | Any characters | PIC X(10) - 10-character string |
| PIC A | Alphabetic | Letters only | PIC A(5) - 5-letter word |
| PIC S9 | Signed numeric | Positive/negative | PIC S9(4)V99 - signed decimal |
| PIC 9V9 | Decimal | Implied decimal point | PIC 9(3)V99 - 123.45 |
| PIC 1 | Boolean | Boolean data (COBOL 2002+) | PIC 1 USAGE BIT - one bit |
| PIC Z | Numeric-edited | Leading zeros replaced by spaces | PIC ZZZ9 - blanks leading zeros |
| PIC P | Scaled numeric | Assumed decimal scaling position; not counted in item size | PIC 9(3)P(3) - scales by 1000 |
| PIC 9 COMP | Binary | Two's complement; 2, 4, or 8 bytes for 1-4, 5-9, or 10-18 digits | PIC S9(4) COMP - 2 bytes |
| PIC 9 COMP-3 | Packed decimal | Two digits per byte; trailing half-byte holds the sign | PIC S9(7) COMP-3 - 4 bytes |
| PIC 9 COMP-5 | Native binary | Uses full capacity of its 2-, 4-, or 8-byte binary field | PIC S9(4) COMP-5 - 2 bytes |
| USAGE COMP-1 | Floating point | Single precision, 4 bytes; PICTURE string not allowed | 01 RATE USAGE COMP-1 |
| USAGE COMP-2 | Floating point | Double precision, 8 bytes; PICTURE string not allowed | 01 TOTAL USAGE COMP-2 |
| PIC N | National | UTF-16 character data, 2 bytes per character | PIC N(10) - 20 bytes |
| PIC G | DBCS | Double-byte characters with USAGE DISPLAY-1, 2 bytes each | PIC G(5) - 10 bytes |
In IBM Enterprise COBOL, COMP and COMP-4 are synonyms of BINARY, and COMP-3 of PACKED-DECIMAL; packed-decimal items hold up to 18 digits, or 31 under the ARITH(EXTEND) compiler option.
Record Structure:
- 01 level: Record definition
- 05/10 levels: Field groupings
- OCCURS: Arrays and tables
- REDEFINES: Overlay definitions
- FILLER: Unused space
- VALUE: Default values
Version Differences
| Version | Year | Key Changes | File Support |
|---|---|---|---|
| COBOL 60 | 1960 | Initial specification | Sequential only |
| COBOL 65 | 1965 | Mass storage files, table handling | Sequential, mass storage facilities |
| COBOL 68 | 1968 | First ANSI standard (X3.23-1968) | Sequential, random access module |
| COBOL 74 | 1974 | DELETE statement, segmentation module | Adds indexed and relative organizations |
| COBOL 85 | 1985 | Scope terminators, EVALUATE, nested programs | No new organizations; adds I/O status codes |
| COBOL 85 Amendment 1 | 1989 | Intrinsic function module (ANSI X3.23a-1989) | No format change |
| COBOL 2002 | 2002 | Object orientation, Unicode, free-form code | No format change |
| COBOL 2014 | 2014 | IEEE 754 arithmetic, dynamic-capacity tables | No format change; Report Writer made optional |
| COBOL 2023 | 2023 | COMMIT/ROLLBACK, asynchronous messaging | Adds LINE SEQUENTIAL organization, DELETE FILE statement |
Compatibility Notes:
- COBOL 85 widely supported in legacy systems
- COBOL 74 and COBOL 85 each changed or removed features, breaking some earlier programs
- File organizations vary by platform/compiler
- EBCDIC vs ASCII differences affect both character encoding and collating sequence, altering sort, merge, comparison, and indexed-file key order
- USAGE BINARY data is big-endian on z/OS with the sign in the leftmost bit; COMP-5 follows the platform's native binary representation
- Packed-decimal items defined with an odd number of digits use all bits of every byte; even digit counts leave an unused half-byte
- The RECORDING MODE clause applies only to QSAM files and is ignored for VSAM files
- Record formats may include platform-specific headers
Technical References
What can I convert COBOL Data Files to?
DataMeans converts COBOL Data Files to clean CSV, Excel, JSON & SQL. Each table is exported as its own file, alongside a structured report of exactly what was extracted.
Do I need special software to open my COBOL Data Files?
No compiler or runtime, but you do need the copybooks. DataMeans reads COBOL data files directly, using the copybooks (.cpy, .cob) that describe their record layouts, so include them with the data. A VSAM dataset has to be unloaded to a flat sequential file first, with IDCAMS REPRO.
Can I preview my COBOL Data Files data before paying?
Yes. DataMeans shows your extracted tables and rows in the browser first, so you only pay when you're ready to download the full CSV, Excel, JSON & SQL export.
Is my data secure?
Yes. Your files are encrypted in transit and at rest, and they're deleted automatically: within 7 days if you don't go ahead with a conversion, and when your download window ends if you do. We never sell or share your data, and we never use it to train machine-learning models.