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
 

 

Getting only date portion of the timestamp

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
hariibm

New User


Joined: 05 Feb 2007
Posts: 61
Location: Chennai

PostPosted: Thu Mar 01, 2007 11:26 pm    Post subject: Getting only date portion of the timestamp
Reply with quote

Hi All,

Please let me know how to redefine a variable (which holds the value timestamp) with another variable so as to get only the date portion of the first variable.

01 A PIC X(26)
01 B PIC X(26) REDEFINES A.

A has the value as current timestamp.
When B is displayed, it should display only the date. Please let me know how the redefines clause has to be changed.


Thanks,
Hari
Back to top
View user's profile Send private message

William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Thu Mar 01, 2007 11:36 pm    Post subject:
Reply with quote

Call me stupid, but who's timestamp? and what is its format?
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Thu Mar 01, 2007 11:53 pm    Post subject:
Reply with quote

Well at 26 bytes, probably DB2, where
Quote:
The internal representation of a timestamp is a string of 10 bytes, each of which consists of two packed decimal digits. The first 4 bytes represent the date, the next 3 bytes the time, and the last 3 bytes the microseconds.
so
Code:
01 B REDEFINES A.
   05 date pic x(10).

Where date is CCYYMMDD
Back to top
View user's profile Send private message
reddy307
Currently Banned

New User


Joined: 09 Jun 2006
Posts: 18

PostPosted: Fri Mar 02, 2007 6:44 pm    Post subject: Re: Getting only date portion of the timestamp
Reply with quote

hi

if it is cobol variable

then u wil get time

time(:timestampvarible)

if it is SQL query

time variable = time(timestamp column)
Back to top
View user's profile Send private message
chester-sarsoso

New User


Joined: 08 Mar 2007
Posts: 1
Location: Makati City, Philippines

PostPosted: Fri Mar 09, 2007 12:51 pm    Post subject:
Reply with quote

if you're getting only the date portion of the timestamp (yyyymmdd), you can just define

03 ws-dater.
05 yy pic 9(4).
05 mm pic 99.
05 dd ppic 99.

then execute the command:

accept ws-dater from FUNCTION CURRENT-DATE.


FUNCTION CURRENT-DATE is an embedded function.
just work with the indentions icon_biggrin.gif
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts TOT & DATE parameter in ICEMAN hemanthj642 DFSORT/ICETOOL 4 Mon Nov 14, 2016 5:19 am
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm
This topic is locked: you cannot edit posts or make replies. Get correct date and time when curren... balaji81_k DB2 24 Fri Oct 14, 2016 10:40 pm
No new posts Change date (DD/MM/YY) in 2nd record ... uday kiran DFSORT/ICETOOL 12 Wed Sep 07, 2016 10:57 pm


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