All systems

COBOL Data Files

COBOL data files
Supported
Guide

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:

OutputDescription
csv/{TableName}.csvOne CSV file per table with all row data
xlsx/{TableName}.xlsxExcel workbook per table (omitted for tables over 1,048,575 rows, 16,384 columns or 8,000,000 cells - see note below)
xls/{TableName}.xlsLegacy Excel format per table (omitted for tables over 65,535 rows, 256 columns or 150,000 cells - see note below)
json/{TableName}.jsonJSON array of records per table
json/{TableName}.jsonlNewline-delimited JSON (streaming-friendly)
postgres.sqlPostgreSQL CREATE TABLE + INSERT statements
mysql.sqlThe same schema and rows, in MySQL dialect
sqlite.sqlThe same schema and rows, in SQLite dialect
ansi.sqlThe same schema and rows, in portable ANSI SQL
sqlserver.sqlThe same schema and rows, in SQL Server (T-SQL) dialect
report.jsonStructured conversion report
report.mdHuman-readable conversion summary

How to Export / Obtain Files

  1. Identify your COBOL data files on the mainframe/server

  2. 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)
    /*
    
  3. Export or FTP the binary data files. Use binary mode: an ASCII-mode transfer corrupts packed decimal (COMP-3) and binary (COMP) fields

  4. If the dataset is variable-length (RECFM=V, VB or VBS), issue SITE RDW before the transfer. FTP discards record descriptor words by default, and without them the record boundaries are gone

  5. Locate corresponding copybook definitions (.cpy, .cob files)

  6. Create a ZIP with data files and copybooks together

  7. 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, so PIC S9(3)V99 COMP holds 305.03 and PIC 9(5)PPP holds 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, 0 or / (a date such as 99/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

IssueSolution
Fields misalignedVerify 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 charactersCheck EBCDIC vs ASCII encoding settings
Numeric errorsConfirm 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 factorCheck 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 .xlsx sheet holds at most 1,048,575 rows of data and 16,384 columns, and a legacy .xls sheet 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 .xlsx copy 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 .xls copy 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.

Technical reference

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 .dat for data, with a separate .idx index 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 ClauseTypeDescriptionExample
PIC 9NumericDigits onlyPIC 9(5) - 5-digit number
PIC XAlphanumericAny charactersPIC X(10) - 10-character string
PIC AAlphabeticLetters onlyPIC A(5) - 5-letter word
PIC S9Signed numericPositive/negativePIC S9(4)V99 - signed decimal
PIC 9V9DecimalImplied decimal pointPIC 9(3)V99 - 123.45
PIC 1BooleanBoolean data (COBOL 2002+)PIC 1 USAGE BIT - one bit
PIC ZNumeric-editedLeading zeros replaced by spacesPIC ZZZ9 - blanks leading zeros
PIC PScaled numericAssumed decimal scaling position; not counted in item sizePIC 9(3)P(3) - scales by 1000
PIC 9 COMPBinaryTwo's complement; 2, 4, or 8 bytes for 1-4, 5-9, or 10-18 digitsPIC S9(4) COMP - 2 bytes
PIC 9 COMP-3Packed decimalTwo digits per byte; trailing half-byte holds the signPIC S9(7) COMP-3 - 4 bytes
PIC 9 COMP-5Native binaryUses full capacity of its 2-, 4-, or 8-byte binary fieldPIC S9(4) COMP-5 - 2 bytes
USAGE COMP-1Floating pointSingle precision, 4 bytes; PICTURE string not allowed01 RATE USAGE COMP-1
USAGE COMP-2Floating pointDouble precision, 8 bytes; PICTURE string not allowed01 TOTAL USAGE COMP-2
PIC NNationalUTF-16 character data, 2 bytes per characterPIC N(10) - 20 bytes
PIC GDBCSDouble-byte characters with USAGE DISPLAY-1, 2 bytes eachPIC 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

VersionYearKey ChangesFile Support
COBOL 601960Initial specificationSequential only
COBOL 651965Mass storage files, table handlingSequential, mass storage facilities
COBOL 681968First ANSI standard (X3.23-1968)Sequential, random access module
COBOL 741974DELETE statement, segmentation moduleAdds indexed and relative organizations
COBOL 851985Scope terminators, EVALUATE, nested programsNo new organizations; adds I/O status codes
COBOL 85 Amendment 11989Intrinsic function module (ANSI X3.23a-1989)No format change
COBOL 20022002Object orientation, Unicode, free-form codeNo format change
COBOL 20142014IEEE 754 arithmetic, dynamic-capacity tablesNo format change; Report Writer made optional
COBOL 20232023COMMIT/ROLLBACK, asynchronous messagingAdds 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

Questions

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.