Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

What's the datatype of Month in Date

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: What's the datatype of Month in Date
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: 686
Location: Earth

PostPosted: Thu Oct 25, 2007 10:32 am    Post subject:
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    Post subject: Reply to: Return Type
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: 686
Location: Earth

PostPosted: Thu Oct 25, 2007 11:58 am    Post subject:
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: 276
Location: Bang,iflex

PostPosted: Thu Oct 25, 2007 12:21 pm    Post subject:
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: 1439
Location: Bangalore,India

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

Minakshi,

Go thru the link -

http://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: 276
Location: Bang,iflex

PostPosted: Thu Oct 25, 2007 12:38 pm    Post subject:
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    Post subject: Hi,
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: 686
Location: Earth

PostPosted: Thu Oct 25, 2007 3:01 pm    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Date and time format in CICS Chandru3183 CICS 2 Sat Mar 18, 2017 12:46 pm
No new posts SORT to append Month and YEAR in MMYY... tisamf DFSORT/ICETOOL 1 Wed Mar 08, 2017 4:46 pm
No new posts How to get current date -1 and curren... murali.andaluri DFSORT/ICETOOL 3 Wed Mar 08, 2017 2:09 pm
No new posts Overlay the system date Danielle.Filteau SYNCSORT 4 Fri Mar 03, 2017 1:16 am
No new posts Checking Current date vickey_dw DFSORT/ICETOOL 1 Wed Feb 08, 2017 11:14 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us