Hi
i need a query which extracts data from a table based on timestamp.
structure of the table will be
Acc.no Data Timestamp
This table will get updated daily..
i need to retrieve the data which gets updated for the current date.
i have a jcl which invokes the cobol/db2 program which will have the query to create a report file have the records from the table..
Jcl is sheduled to run daily, so i need query which retrieves the data based on timestamp column.
Please help!!
Need a query!! please help
Moderators: Kalicharan, Moderator Group
-
- Member
- Posts: 14
- Joined: Thu Jun 16, 2011 10:18 am
Need a query!! please help
Thanks,
Ganesh.
Ganesh.
-
- Moderator
- Posts: 1625
- Joined: Sat Aug 09, 2008 9:02 am
- Location: Mumbai, India
- dbzTHEdinosauer
- Moderator
- Posts: 981
- Joined: Mon Oct 02, 2006 8:31 pm
Code: Select all
WHERE <acc.no data timestamp> BETWEEN TIMESTAMP (CURRENT_DATE, '00.00.00')
AND TIMESTAMP (CURRENT_DATE, '23.59.59') + 999999 MICROSECOND
Code: Select all
SELECT TIMESTAMP (CURRENT_DATE, '00.00.00')
, TIMESTAMP (CURRENT_DATE, '23.59.59') + 999999 MICROSECOND
FROM SYSIBM.SYSDUMMY1
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.
-
- Member
- Posts: 14
- Joined: Thu Jun 16, 2011 10:18 am
Hi Dick,
Thankyou very much for your quick reply!!
i am getting the required result..
i have another doubt, how to find the (CURRENT_DATE - 1 day)
i tried with below query
SELECT TIMESTAMP (SELECT(CURRENT_DATE - 1 days), '00.00.00' FROM SYSIBM.SYSDUMMY1) , TIMESTAMP ((SELECT (CURRENT_DATE - 1 days), '23.59.59')) + 999999 MICROSECOND
FROM SYSIBM.SYSDUMMY1
i am getting error !!
please correct me
Thankyou very much for your quick reply!!
i am getting the required result..
i have another doubt, how to find the (CURRENT_DATE - 1 day)
i tried with below query
SELECT TIMESTAMP (SELECT(CURRENT_DATE - 1 days), '00.00.00' FROM SYSIBM.SYSDUMMY1) , TIMESTAMP ((SELECT (CURRENT_DATE - 1 days), '23.59.59')) + 999999 MICROSECOND
FROM SYSIBM.SYSDUMMY1
i am getting error !!
please correct me
Thanks,
Ganesh.
Ganesh.
- dbzTHEdinosauer
- Moderator
- Posts: 981
- Joined: Mon Oct 02, 2006 8:31 pm
- dbzTHEdinosauer
- Moderator
- Posts: 981
- Joined: Mon Oct 02, 2006 8:31 pm
SELECT TIMESTAMP(CURRENT_DATE - 1 DAY,'00.00.00')
FROM SYSIBM.SYSDUMMY1
;
SELECT TIMESTAMP(CURRENT_DATE - 1 DAY,'23.59.59') + 999999 MICROSECOND
FROM SYSIBM.SYSDUMMY1
;
you really need to learn how to debug you syntax.
why could you not experiement and determine the correct syntax on your own?
FROM SYSIBM.SYSDUMMY1
;
SELECT TIMESTAMP(CURRENT_DATE - 1 DAY,'23.59.59') + 999999 MICROSECOND
FROM SYSIBM.SYSDUMMY1
;
you really need to learn how to debug you syntax.
why could you not experiement and determine the correct syntax on your own?
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.
FREE TUTORIALS
Tutorials
Free tutorials from mainframegurukul
- JCL Tutorial
Covers all important JCL concepts. - Cobol Tutorial
This tutorials covers all Cobol Topics from STRING to COMP-3. - DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. - SORT Tutorial
This Tutorial covers all important aspects of DFSORT with examples - CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions
- Cobol Interview Questions
50+ Interview Questions - JCL Interview Questions
50+ Interview Questions - DB2 Interview Questions
100+ Interview Questions - CICS Interview Questions
70+ Interview Questions - VSAM Interview Questions
27 Interview Questions
Other References
Mainframe Tools and others
- XPEDITER Reference
Explains how we can debug a program - FILEAID Reference
Explains how to browse , edit and delete datasets - Change Man Reference
Quick Start tutorial on Changeman - Abend Reference
Important Abend codes explained - FaceBook Page
MainframeGurukul FaceBook Page - LinkedIn Page
MainframeGurkul Linkedin Page