IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

What's the datatype of Month in Date


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
minakshi

New User


Joined: 02 Oct 2007
Posts: 7
Location: Delhi

PostPosted: Thu Oct 25, 2007 10:25 am
Reply with quote

What's the datatype of Month in Date or what would be the return type of Month ?
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Thu Oct 25, 2007 10:32 am
Reply with quote

Could you please explain your question a little bit?
Back to top
View user's profile Send private message
minakshi

New User


Joined: 02 Oct 2007
Posts: 7
Location: Delhi

PostPosted: Thu Oct 25, 2007 11:13 am
Reply with quote

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
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Thu Oct 25, 2007 11:58 am
Reply with quote

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
View user's profile Send private message
vasanthkumarhb

Active User


Joined: 06 Sep 2007
Posts: 275
Location: Bang,iflex

PostPosted: Thu Oct 25, 2007 12:21 pm
Reply with quote

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.... icon_smile.gif
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Thu Oct 25, 2007 12:27 pm
Reply with quote

Minakshi,

Go thru the link -

publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=/com.ibm.db2.xquery.doc/xqrdate.html
Back to top
View user's profile Send private message
vasanthkumarhb

Active User


Joined: 06 Sep 2007
Posts: 275
Location: Bang,iflex

PostPosted: Thu Oct 25, 2007 12:38 pm
Reply with quote

Murli,



thank you, it is very helpfull for me too.



Regard's
Vasanth
Back to top
View user's profile Send private message
revel

Active User


Joined: 05 Apr 2005
Posts: 135
Location: Bangalore/Chennai-INDIA

PostPosted: Thu Oct 25, 2007 12:39 pm
Reply with quote

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
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Thu Oct 25, 2007 3:01 pm
Reply with quote

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
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Thu Oct 25, 2007 6:05 pm
Reply with quote

In DB2 for the functions DAYOFMONTH or MONTH the return type is large integer.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Populate last day of the Month in MMD... SYNCSORT 2
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Need to convert date format DFSORT/ICETOOL 20
Search our Forums:

Back to Top