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

issue with timestamp differece


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
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
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: 6966
Location: porcelain throne

PostPosted: Mon Nov 02, 2009 6:44 pm
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
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: 6966
Location: porcelain throne

PostPosted: Mon Nov 02, 2009 7:13 pm
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
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: 6966
Location: porcelain throne

PostPosted: Tue Nov 03, 2009 2:27 pm
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: 6966
Location: porcelain throne

PostPosted: Tue Nov 03, 2009 4:57 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts To get the count of rows for every 1 ... DB2 3
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Issue after ISPF copy to Linklist Lib... TSO/ISPF 1
No new posts Insert system time/date (timestamp) u... DFSORT/ICETOOL 5
No new posts Timestamp difference and its average ... DB2 11
Search our Forums:

Back to Top