Tuesday, October 10, 2006

Review topic: DB2, date and time

Some quizzes on DB2 programming may test knowledge of date formats. Sometimes there is confusion about character and numeric representations.

A DATE data type in DB2 is represented in character format in Y2K chronological: “yyyy-mm-dd”. That is 10 characters in COBOL. The order will always be in logical chronological sequence.

In a similar fashion, a TIME data type is simply hh-mm-ss, 8 characters in COBOL.

However, these types have the implicit ability to generate durations (when two different items are “subtracted”) and to be modified by adding and subtracting durations. DB2 regards as date duration as DEC(8,0) which would be hosted by COBOL in a variable as PIC S9(8) COMP-3. Time duration would be regarded as DEC (6,0) and have a COBOL picture of PIC S9(6) COMP-3. (The pictures could obviously be S9(9) COMP-3 and S9(7) COMP-3., to fit within EBCDIC)

By the way, here is a good Ascii-EBCDIC chart.

1 comment:

Anonymous said...

Give me link to SEO software (promotion, advertisement, etc.). I'm need it to promote my new e-shop.
Thanks.