October 28th, 2008

Date/Time/Timestamp Data, Part 1 of 2

Posted by admin in F. Data Types

Date, time, and timestamp data is represented by the following:

> The SQL standard requires that the date, time, and timestamp are maintained internally based on Universal Coordinated Time (UCT) which used to be called Greenwich Mean Time (GMT). Then an offset is applied for your location. For example, New York has an offset of -5, Dallas has -6, Denver has -7, and Los Angeles has -8.
These change for daylight savings time in the U.S.
> The date is based on the rules of the Gregorian calendar. A hyphen (-) separates the parts of the date. The standard SQL date has the keyword DATE ahead of the date literal, such as DATE ’2056-02-20′.
> The time is based on a 24-hour clock, just like military time, so 17:00 is the same as 5:00 PM. A colon (:) separates the parts of time such as TIME ’17:30:45′.
> A timestamp is a combination of date and time such as TIMESTAMP ’2056-02-20 17:30:45′.
> A space is used to separate date and time when both are present.
> You can compare two DATE, TIME, or TIMESTAMP values if they are of the same format.
> SQL can not handle dates that are Before the Common Era (BCE) or Before Christ (BC).

> Access surrounds date-time literals with the pound sign (#), so that the standard SQL date
DATE ’2056-02-20′ is the same as the Microsoft Access’ #2056-02-20#.
> DB2 & SQL Server omit the key word DATE, TIME, and TIMESTAMP ahead of the literal.
> The external representation may be set to ISO, USA, EUR, or JIS. We use ISO in our examples.

October 27th, 2008

LONG VARGRAPHIC(length) Data

Posted by admin in F. Data Types

In DB2 the LONG VARGRAPHIC data type can have 0 to 16,357 characters of 16-bit Double Byte Character Set data in variable length format for 32K pages, or 2,028 DBCS characters for 4K pages of storage. With DBCS, each 2 bytes of data represents a graphic character. This data type is also rarely used. Consult your RDBMS systems manual for further details.

Example:    COL1 LONG VARGRAPHIC(1000)

COL1 has up to 1000 bytes of up to 500 variable double-byte characters.

In COBOL:  05  COL1-GROUP.
               49 COL1-LENGTH   PIC S9(9) COMP.
               49 COL1          PIC G(1000) DISPLAY-1.

In COBOL, G(1000) means 2,000 bytes of 1,000 DBCS characters.

October 24th, 2008

VARGRAPHIC(length) Data

Posted by admin in F. Data Types

In DB2 the VARGRAPHIC data type can have 0 to 127 characters of 16-bit Double Byte Character Set data in variable length format. With DBCS, each two bytes of data represents a graphic character. This data type is also rarely used. Consult your RDBMS systems manual for further details.

Example:    COL1 VARGRAPHIC(50)

COL1 has up to 100 bytes of up to 50 variable double-byte characters.

In COBOL:  05  COL1-GROUP.
               49 COL1-LENGTH   PIC S9(4) COMP.
               49 COL1          PIC G(50) DISPLAY-1.

In COBOL, G(50) means 100 bytes of 50 DBCS characters.

Oracle’s VARCHAR2(length) has a maximum length of 2000.

« Previous PageNext Page »