I am trying to building a ddl statement off a cobol layout

I am trying to build a DDL statement off a COBOL program layout.  I have never used COBOL syntax before.

I AM NOT SURE WHAT PIC X(26) , PIC XX OR PIC X MEAN?
Example:
Cobol layout
TIMESTAMP                  PIC X(26).                        
CPIS_CMPY_CDE              PIC XX.                        
DCH_CAPSIL_CMPY_CDE            PIC X  

New ddl statement in Teradata
TIMESTAMP                  char(26)                        
CPIS_CMPY_CDE           ?                
DCH_CAPSIL_CMPY_CDE            ?

i HAVE INCLUDE A TEXT FILE OF THE COBOL LAYOUT I TRYING TO CREATE DDL STATEMENT.
CAPSIL-MA-Layout-Mar10.txt
centralmikeAsked:
Who is Participating?
 
Dave FordSoftware Developer / Database AdministratorCommented:
Something like this should do it ...

create table MySchema,MyTable (
   dchTIMESTAMP char(26),                        
   dchCPISCMPYCDE char(02),                        
   dchCAPSILCMPYCDE char(02),                        
   dchPOLNUM char(15),                        
   dchPOLFORM  char(15),                        
   dchAPPLRECVDATE  char(10),                        
   dchFINALDISPDATE char(10),                        
   dchPOLEFFDATE  char(10),                        
   dchPOLBILLFREQ char(02),                        
   dchPOLBILLTYPE char(02),                        
   dchPOLSTATUS  char(03),                        
   dchPOLSTATUSREASON  char(03),                        
   dchPOLSTATUSDATE char(10),                        
   dchMECSTATUS  char(03),                        
   dchMECSTATUSRSN  char(03),                        
   dchMECSTATUSDATE char(10),                        
   dchSTOPBILLSTATUS char(03),                        
   dchSTOPBILLSTATUSRSN  char(03),                        
   dchSTOPBILLSTARTDATE  char(10),                        
   dchPOLPDTODATE char(10),                        
   dchPOLRENWLPREMAMT  char(17),                        
   dchPOLRENWLPREMSTARTDATE  char(10),                        
   dchPOLACCUMPREMAMT  char(17),                        
   dchPOLSUSPENSEIND char(1),                            
   dchPOLAPLIND  char(1),                            
   dchPOLAPDIND  char(1),                            
   dchPENSIONPLANTYPE  char(2),                         
   dchNONFORFEITOPT  char(1),                            
   dchPOLKEYLINE char(15),                        
   dchBSPADMINSYS  char(1),                            
   dchBSPCOLLATE char(06),                        
   dchBSPDRAWDATE char(10),                        
   dchCURRCREDITCARD char(16),                        
   dchPREVCREDITCARD char(16),                        
   dchPOLPROMOID  char(06),                        
   dchNEXTCCBILLDATE  char(10),                        
   dchCCCREDITAMT char(17),                        
   dchCCCREDITSTARTDATE  char(10),                        
   dchFORMERPOLRSN char(1),                            
   dchFORMERPOLRSNTYPE  char(1),                            
   dchFORMERPOLCMPY  char(2),                         
   dchFORMERPOLNUM  char(15),                        
   dchCURRINTRATE char(12),                        
   dchCURRINTRATESTARTDATE char(10),                        
   dchLOANAMTREDUCED char(1),                            
   dchLOANINTADVCDE char(1),                            
   dchLOANFREQ  char(2),                         
   dchLOANINTRATE char(12),                        
   dchLOANAMT  char(17),                        
   dchLOANSTARTDATE char(10),                        
   dchLOANINTBILLEDAMT  char(17),                        
   dchLOANINTBILLSTARTDATE char(10),                        
   dchLOANINTDUEDATE  char(10),                        
   dchLOAN1FREQ char(2),                         
   dchLOAN1INTRATE  char(12),                        
   dchLOAN1AMT char(17),                        
   dchLOAN1STARTDATE char(10),                        
   dchLOAN1INTBILLEDAMT  char(17),                        
   dchLOAN1INTBILLSTARTDATE  char(10),                        
   dchLOAN1INTDUEDATE  char(10),                        
   dchLOAN2FREQ char(2),                         
   dchLOAN2INTRATE  char(12),                        
   dchLOAN2AMT char(17),                        
   dchLOAN2STARTDATE char(10),                        
   dchLOAN2INTBILLEDAMT  char(17),                        
   dchLOAN2INTBILLSTARTDATE  char(10),                        
   dchLOAN2INTDUEDATE  char(10),                        
   dchAPLFREQ char(2),                         
   dchAPLINTRATE  char(12),                        
   dchAPLAMT char(17),                        
   dchAPLSTARTDATE  char(10),                        
   dchAPLINTBILLEDAMT  char(17),                        
   dchAPLINTBILLSTARTDATE  char(10),                        
   dchAPLINTDUEDATE char(10),                        
   dchTHRSPREMAMT char(17),                        
   dchTHRSPREMSTARTDATE  char(10),                        
   dchPOLAPPSIGNDATE  char(10),                        
   dchPOLISSUESTATE  char(2)
)

Open in new window


HTH,
DaveSlash
0
 
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
PIC stands for PICTURE, and starts a (visual) format description.
X stands for "any arbitrary character" => char(1)
XX is the same as X(2) => char(2).
0
 
tliottaCommented:
Assuming that you want exactly the column definitions that the COBOL structure contains, DaveSlash has it started very well for you. Just continue through the rest of the fields and all should be okay.

But it looks like the resulting table definition would only be used as an intermediate or staging table before the data is converted to a better representation.

For example, if the actual final table really has a "timestamp" value in the DCH-TIMESTAMP field, you shouldn't have that defined as CHAR (26). It should instead be defined as a TIMESTAMP column.

A number of other details should be attended to, but we don't know what they all should be. If you can describe the business problem that you need to solve, we can give much more complete suggestions. Include the DB2 version as well.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.