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
September 14th, 2009

Host Programs, C#

Posted by admin in S. Host Programs
Syntax Element      In C#
prefix              EXEC SQL
terminator          ;
target              label
Variable Definition Syntax
C# variable definition =
    [auto | extern | static] [const | volatile]
    C numeric variable | C character variable
  | C derived variable;
C# numeric variable =
    {long | short | int | decimal | double}
    {variable name [initial value] }.,..
C# character variable =
    char [CHARACTER SET [IS] character set name]
    {variable name {length} [initial value] }.,..
C# derived variable =
    { VARCHAR [CHARACTER SET [IS] character set name]
    {variable name {length} [= character representation... ] }.,..} |
    { BIT{variable name {length} [= character representation... ] }.,..}
The length is the fixed length or the maximum varying
length of the string, and the character representation
sequence is an optional initial value.
SQL Type            C# Type
BIGINT              long
BIT                 bool
CHAR                string
DATE                byte[]
DECIMAL             decimal
FLOAT               double
INTEGER             int
SMALLINT            short
TIME                byte[]
TIMESTAMP           byte[]
TINYINT             byte
VARCHAR             string
SQLCODE             long
SQLSTATE            char 6
indicator           short or long
September 7th, 2009

Host Programs, C and C++

Posted by admin in S. Host Programs
Syntax Element      In C and C++
prefix              EXEC SQL
terminator          ;
target              label
Variable Definition Syntax
C and C++ variable definition =
    [auto | extern | static] [const | volatile]
    C numeric variable | C character variable
  | C derived variable;
C and C++ numeric variable =
    {long | short | float | double}
    {variable name [initial value] }.,..
C and C++ character variable =
    char [CHARACTER SET [IS] character set name]
    {variable name {length} [initial value] }.,..
C and C++ derived variable =
    { VARCHAR [CHARACTER SET [IS] character set name]
    {variable name {length} [= character representation... ] }.,..} |
    { BIT{variable name {length} [= character representation... ] }.,..}
The length is the fixed length or the maximum varying
length of the string, and the character representation
sequence is an optional initial value.
SQL Type            C and C++ Type
BIGINT              long long
CHAR(1)             char
CHAR(n)             char(n+1)
CLOB(n)             clob(n)
DATE                char(11) with null-terminator
DOUBLE              double
INTEGER             long int
REAL                float
SMALLINT            short int
TIME                char(9) with null-terminator
TIMESTAMP           char(27) with null-terminator
VARCHAR(n)          char[n+1]
SQLCODE             long
SQLSTATE            char 6
indicator           short or long
« Previous PageNext Page »