September 21st, 2009

Host Programs, COBOL

Posted by admin in S. Host Programs
Syntax Element      In COBOL
prefix              EXEC SQL
terminator          END-EXEC
target              section name or
                    unqualified paragraph name
Variable Definition Syntax
COBOL variable definition =
    {01|77} COBOL host identifier type spec [ character
    representation... ] .
COBOL type spec =
    bit type | character type | integer type | numeric type
COBOL binary integer =
    { PIC | PICTURE } [IS] { X [(length)] }...
    [ USAGE [IS] ] BINARY
COBOL bit type =
    { PIC | PICTURE } [IS] { B [(length)] }...
COBOL character type =
    [CHARACTER SET [IS] character set name]
    { PIC | PICTURE } [IS] { X [(length)] }...
COBOL computational integer =
    { PIC | PICTURE } [IS] S{9 [(length)] }...
    [ USAGE [IS] ] { COMP | COMPUTATIONAL }
COBOL integer type =
    binary integer | computational integer
COBOL numeric type =
    { PIC | PICTURE } [IS] S{9 [(length)] }...
    [ V [{9 [(length)] }...] ] | V{9 [(length)] }...
    [ USAGE [IS] ] DISPLAY SIGN LEADING SEPARATE
SQL Type                 COBOL Type
BIT                      requires conversion
BIT(n)                   PIC X(1)
CHAR(n)                  PIC X(n)
DATE                     PIC X(5)
DECIMAL(p,s)             PIC V9(s) COMP-3
DOUBLE PRECISION         COMP-2
FLOAT                    COMP-1 ( 6 digits of precision)
                         COMP-2 (16 digits of precision)
GRAPHIC(n)               PIC G(n) DISPLAY-1
INTEGER                  PIC S9(9) COMP
LONG VARGRAPHIC          05  name-group.
 (up to 16357 DBCS)          49 name-length PIC S9(9) COMP.
                             49 NAME PIC G(n) DISPLAY-1.
NUMERIC(p,s)             PIC S9(p-s)
REAL                     COMP-1
SMALLINT                 PIC S9(4) COMP
TIME                     PIC X(4)
TIMESTAMP                PIC X(11)
VARCHAR(n)               05  name-group.
 (up to 32767 chars)         49  name-length PIC S9(9) COMP.
                             49 NAME PIC X(n).
VARGRAPHIC(n)            05 name-group.
 (up to 127 DBCS)            49 name-length PIC S9(4) COMP.
                             49 NAME PIC G(n) DISPLAY-1.
SQLCODE                  computational integer
SQLSTATE                 character type
indicator                binary integer

Comments are closed.

Sorry, the comment form is closed at this time.