View previous topic :: View next topic
|
Author |
Message |
minakshi
New User
Joined: 02 Oct 2007 Posts: 7 Location: Delhi
|
|
|
|
What's the datatype of Month in Date or what would be the return type of Month ? |
|
Back to top |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
Could you please explain your question a little bit? |
|
Back to top |
|
|
minakshi
New User
Joined: 02 Oct 2007 Posts: 7 Location: Delhi
|
|
|
|
In Date we have something like mm for Month , so if we consider it seperately, what would be it's data type ? |
|
Back to top |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
I guess we dont have separate datatype as Month in DB2 however you can use different functions of Db2 to work with month part. In that you can compare month with string. How dates are stored internally is transparant to the user. Let us know if you needed something else. |
|
Back to top |
|
|
vasanthkumarhb
Active User
Joined: 06 Sep 2007 Posts: 275 Location: Bang,iflex
|
|
|
|
Hi,
If you extracting only MM from your date part, then also it is numeric only, data type is numeric.
in cobol declaration is 01............
05.......
05 month PIC 9(2) value 0
Regard's
Vasanth.... |
|
Back to top |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
Back to top |
|
|
vasanthkumarhb
Active User
Joined: 06 Sep 2007 Posts: 275 Location: Bang,iflex
|
|
|
|
Murli,
thank you, it is very helpfull for me too.
Regard's
Vasanth |
|
Back to top |
|
|
revel
Active User
Joined: 05 Apr 2005 Posts: 135 Location: Bangalore/Chennai-INDIA
|
|
|
|
The DATATYPE for DATE is vary for COBOL, CICS and DB2
ex;
1)
Working Storage
000340 01 W01-CURRENT-DATE.
000370 05 W01-CC PIC XX.
000370 05 W01-YY PIC XX.
000380 05 W01-MM PIC XX.
000390 05 W01-DD PIC XX.
000400 05 W01-HH PIC XX.
000410 05 W01-MM PIC XX.
000410 05 W01-SS PIC XX.
000420 05 W01-SSHH PIC XX.
000430 05 W01-GMTO PIC X(5).
-------------------------------------------------------------------------
000440
000450 01 W02-DATE.
000460 05 W02-CCYYMMDD PIC X(08).
-------------------------------------------------------------------------
Current-Date Example Number 1
004310
004320 MOVE FUNCTION CURRENT-DATE to W01-CURRENT-DATE.
004430 MOVE W01-CURRENT-DATE(1:8) TO W02-DATE.
004440
or
We can decalre Variable as NUMERIC DATA ITEM, then we can push DATE to that VARIABLE
The Above case is in COBOL
-------------------------------
But in case of CICS
It will declared as S9(15) COMP
--------------------------------
In DB2
The DATA Type is DATE, that is transparent to user..
Any suggestion is welcomed
Raghav |
|
Back to top |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
The link which murali has given points to DB2 Version 9 for Linux, UNIX, and Windows manual. It may not hold true for mainframes.
On mainframes date is still 3 part structure. 'yyyy-mm-dd'.
(Lets hope it will catch up soon)
The internal representation of a date is a string of 4 bytes. Each byte
consists of two packed decimal digits. The first 2 bytes -year, the third -month, and the last byte - day.
This is tranparant to programmer as DCLGEN equivalent of date is PIC X(10) in HOST language like COBOL,PL/I.
Coming back to the original question-
In host language - Month is X(02)
Internal to Db2 - 1 byte unsigned packed decimal. |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
In DB2 for the functions DAYOFMONTH or MONTH the return type is large integer. |
|
Back to top |
|
|
|