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
 

 

issue with timestamp differece

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
Bhanupratap Natva

New User


Joined: 13 Jul 2007
Posts: 8
Location: Hyderabad

PostPosted: Mon Nov 02, 2009 6:17 pm    Post subject: issue with timestamp differece
Reply with quote

Hi,

I have below requirement :

Input table layout

seq-id char(5) not null
file-recv-time-stamp timestamp not null with default
file-process-start-time-ts timestamp not null with default
file-proc-end-time-ts timestamp not null with default

I want to populate the output file with the below details from the input-table.

Output-file-layout:

seq-id , file-process-start-time-ts, file-proc-end-time-ts, process-duration

I have tried the below query

SELECT seq-id, file-proc-end-time-ts, file-process-start-time-ts, TIME(file-proc-end-time-ts) - TIME(file-process-start-time-ts)
AS process-duration
FROM CUST_TABLE

Fetch cursor logic -->

Fetch Cursor_a
into :SEQ-ID,
: FILE-PROC-END-TS,
: FILE-PROC-STRT-TS,
: process-duration

When I run the above query in QMF it is working fine.
but when I tried in the program it is giving -303. Also I have defined
WS-PROCESS-TIME with X(26) in the program.

Could anyone tell me the way to populate process-time in the output-file.
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Mon Nov 02, 2009 6:44 pm    Post subject:
Reply with quote

I can only assume from your fractured question that process-duration
is improperly defined

there is a preview button
(though you do have to modify your profile to enable this)
which you could use to see if the letters that you have managed to type
convey anything intelligent in your post.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


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

PostPosted: Mon Nov 02, 2009 7:03 pm    Post subject:
Reply with quote

process-duration or WS-PROCESS-TIME which ever one you used must be defined as s9(14)v9(6) field.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Mon Nov 02, 2009 7:13 pm    Post subject:
Reply with quote

TIME(file-proc-end-time-ts) - TIME(file-process-start-time-ts)

defined as s9(14)v9(6) field - timestamp arithmetic
Back to top
View user's profile Send private message
Bhanupratap Natva

New User


Joined: 13 Jul 2007
Posts: 8
Location: Hyderabad

PostPosted: Tue Nov 03, 2009 2:06 pm    Post subject:
Reply with quote

dbzTHEdinosauer wrote:
TIME(file-proc-end-time-ts) - TIME(file-process-start-time-ts)
defined as s9(14)v9(6) field - timestamp arithmetic


Hi dbzTHEdinosauer/Craq Giegerich,

I have tried defining the field with s9(14)v9(6) but the compiler is not
allowing the dataname to be defined with size more than 18 bytes.

Could any one suggest that, Is there any provision in DB2 to get the process-time thru cursor.
Note that process-time is not a column.

Thanks,
[EMAIL ID REMOVED]
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Tue Nov 03, 2009 2:27 pm    Post subject:
Reply with quote

FFS, why don't you read the links?

your sql is performing TIME arithmetic
not TIMESTAMP.

Time arithmetic requires a integer length 6.

craig provided 14v6 for timestamp - according to the manual it is 20v6.

if you need to increase your COBOL numeric capabilities, look at compiler option: ARITH.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Tue Nov 03, 2009 4:57 pm    Post subject:
Reply with quote

additional comments:

if you do not want to use compiler options to allow for more than 18 digits,
suggest you use both
TIME(ts) - TIME(ts)
and
DATE(ts) - DATE(ts).

you need to know if the difference in timestamps is more than 24 hours
and you can not derive that by only using TIME
and to use TIMESTAMP - TIMESTAMP you need a larger host variable.
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 Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am
No new posts Execessive parameter issue Sumeendar JCL & VSAM 5 Mon Dec 19, 2016 4:35 pm
No new posts DFHRESPONSE returns issue divated CICS 3 Wed Nov 02, 2016 6:32 pm
No new posts Can sending 5 MB data between cobol p... Kevin Vaz CICS 12 Tue Oct 18, 2016 4:50 pm
No new posts Converting EBCDIC to Unicode (TimeStamp) muralikrishnan_new COBOL Programming 2 Mon Jul 25, 2016 10:42 pm


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