COBOL to Oracle PL/SQL Migration

SQLines provides open source tools and services to help you convert existing COBOL stored procedures and programs to Oracle PL/SQL.

SQLines Tools

You can use SQLines SQL Converter tool to convert COBOL programs to Oracle PL/SQL. Currently the conversion is available in the command line only:

sqlines -sl=cobol -s=db2 -t=oracle -in=program.cbl

Migration Reference

Technical information on migration from COBOL to Oracle PL/SQL.

Language Elements

Converting language elements:

COBOL Oracle PL/SQL
1 * comment text * in 7 column -- comment text
2 VAR-NAME Dash (-) sign in identifiers VAR_NAME Converted to underscore (_)

Program Options

Converting COBOL program options:

COBOL Oracle PL/SQL
1 CBL RENT Shared code Not required, removed

IDENTIFICATION DIVISION

Converting IDENTIFICATION division and its paragraphs:

COBOL Oracle PL/SQL
1 PROGRAM-ID. name. Program name CREATE OR REPLACE PACKAGE name IS
2 AUTHOR. name. Program author Commented
3 DATE-WRITTEN. date. Program creation date Commented
4 DATE-COMPILED. date. Program compilation date Commented

ENVIRONMENT DIVISION

Converting ENVIRONMENT division and its paragraphs:

COBOL Oracle PL/SQL
1 INPUT-OUTPUT SECTION. File and I/O paragraphs Removed

INPUT-OUTPUT SECTION. paragraphs:

COBOL Oracle PL/SQL
1 FILE-CONTROL. file-control paragraph Removed

DATA DIVISION

Converting DATA division and its sections:

COBOL Oracle PL/SQL
1 FILE SECTION. Fields of records for used files
2 WORKING-STORAGE SECTION. Static program variables Package variables
3 LINKAGE SECTION. Input and output program variables Package procedure parameters

Data types and formats:

COBOL Oracle PL/SQL
1 PIC X(n) Character string VARCHAR2(n)
PIC XXXXX VARCHAR2(5)
2 PIC 9(n) Integer number NUMBER(n)
3 PIC S9(n) Signed integer number NUMBER(n)

DB2 COBOL stored procedure data types:

DB2 SQL DB2 COBOL Mapping Oracle PL/SQL
1 name VARCHAR(n) 01 name.
49 length PIC S9(4).
49 name PIC X(n).
name VARCHAR2(n)

SQL declarations:

COBOL Oracle PL/SQL
1 EXEC SQL INCLUDE SQLCA END-EXEC. SQL communication area Not required, removed
2 EXEC SQL DECLARE cur CURSOR
FOR select_stmt END-EXEC.
Cursor declaration CURSOR name IS select_stmt;

PROCEDURE DIVISION

Converting PROCEDURE division and its statements:

COBOL Oracle PL/SQL
1 IF bool_expr [THEN] … [ELSE …] [END-IF] IF statement IF bool_expr THEN … [ELSE …] END IF;
2 MOVE value TO var Assigmnent statement var := value