?
Solved

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

Posted on 2016-03-14
3
Medium Priority
?
230 Views
Last Modified: 2016-04-21
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
0
Comment
Question by:centralmike
3 Comments
 
LVL 72

Assisted Solution

by:Qlemo
Qlemo earned 500 total points
ID: 41507380
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
 
LVL 18

Accepted Solution

by:
Dave Ford earned 1000 total points
ID: 41507998
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
 
LVL 27

Assisted Solution

by:tliotta
tliotta earned 500 total points
ID: 41508787
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

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How much do you know about the future of data centers? If you're like 50% of organizations, then it's probably not enough. Read on to get up to speed on this emerging field.
MSSQL DB-maintenance also needs implementation of multiple activities. However, unprecedented errors can hamper the database management. In that case, deploying Stellar SQL Database Toolkit ensures fast and accurate database and backup repair as wel…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

579 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question