Surprised!, so was i, when one of Managers sent me a COBOL DATA Structure and asked me if i can REPLICATE this into the SQL Server Table. My First reaction was ‘HO WOW!’. Then i recollected my memory, which goes back to 1993 and started putting the pieces together, and just wanted to share this information with the would be AUDIENCE, in a similar situation.

COBOL TYPES against a SQL Server Data Type are something like this:

PIC X = can be CHAR (X represents the CHARACTER Data)

PIC X(1) = CHAR(1)

PIC S9(4) = can be INT (9 indicates the digit)

PIC S9(4),V9(4) = DECIMAL(8,4) (V indicates the position of the decimal point and only in a numeric value)

PIC S9(4),V9(4) COMP-3 = can also be DECIMAL(8,4)

Basic Example: (i have included the COBOL Types Just as a reference-they don’t have to be there)

CREATE TABLE LEVEL_A
(
[A1]  CHAR(18)             PIC X(18).
[A2]  CHAR(11)          PIC X(11).
[A3]  CHAR(8)           PIC X(8).
[A4]  CHAR(15)          PIC X(15).
[A5]  DECIMAL(6,4)      PIC S9(2)V9(4)   COMP-3.
[A6]  DECIMAL(6,4)      PIC S9(2)V9(4)   COMP-3.
[A7]  CHAR(7)        PIC X(7).
[A8]  CHAR(7)            PIC X(7).
[A9]  CHAR(4)          PIC X(4).
[A10] INT        PIC S9(4) COMP.
[A11] CHAR(8)        PIC X(8).
[A12] CHAR(1)        PIC X(1).
[A13] CHAR(6)         PIC X(6).
[A14] DECIMAL(8,4)      PIC S9(4)V9(4)   COMP-3.
[A15] DECIMAL(8,4)      PIC S9(4)V9(4)   COMP-3.
[A16] CHAR(2)           PIC X(2).
)

© 2010 D B A N A T I O N Suffusion WordPress theme by Sayontan Sinha
Better Tag Cloud