View previous topic :: View next topic
|
Author |
Message |
amitkumar_sindhi
New User
Joined: 20 May 2005 Posts: 8
|
|
|
|
Hi,
I have following cursor
EXEC SQL
DECLARE OPCONUM-CSR CURSOR FOR
SELECT PCRD_OPCO
,PCRD_PCARD
,PCRD_RUN_DATE
,PCRD_AMOUNT
,PCRD_STATUS
,PCRD_SEQ
FROM R71DB2.PROC_CARD_DTL
WHERE PCRD_OPCO = :PCRD-OPCO
UNION
SELECT PCRH_OPCO
,PCRH_PCARD
,PCRH_RUN_DATE
,PCRH_AMOUNT
,PCRH_STATUS
,PCRH_SEQ
FROM R71DB2.PROC_CARD_HIST
WHERE PCRH_OPCO = :PCRH-OPCO
ORDER BY 5,3 DESC
FOR READ ONLY
END-EXEC.
here PCRD_RUN_DATE,PCRH_RUN_DATE is MMDDYYYY format, so
if there are two dates 12/09/2005, 02/01/2006 the output
of the query will not give the dates in the descending order
as it will compare 12092005 with 02012006 and
hence 12092005 will come first though 02012006 is greater.
is there any date function that can be used? so that the
dates can be get in descending order i.e. is it possible to change the
format to YYYYMMDD while ordering?, but in the output date should be in the format mm-dd-yyyy.
Regards,
Amit |
|
Back to top |
|
|
prabs2006
Active User
Joined: 12 Jan 2006 Posts: 103
|
|
|
|
Hi Amit,
Try this and let me know it works..
CHAR(PCRD_RUN_DATE, ISO)
CHAR(PCRH_RUN_DATE, ISO)
Thanks & Regards
Prabs |
|
Back to top |
|
|
Mane Sagar
New User
Joined: 12 Jul 2005 Posts: 41 Location: mumbai
|
|
|
|
Hi,
Can anyone please solve my query
I want to accept the system date.
ACCEPT WS-DATE FROM DATE.
This is in the form YYMMDD.
Can we get CC too as CCYYMMDD from the system
Please clarify.
Rgds,
SaMa |
|
Back to top |
|
|
prabs2006
Active User
Joined: 12 Jan 2006 Posts: 103
|
|
|
|
Hi Mane,
There is a function in cobol but confirm it with TSO QW (help) from ur mainframes.
Function current_timestamp
This is a 21 byte field which will tell u till microsec .Use reference to get the format as u need it. BTW, I am uncertain whether that shud be a hyphen or underscore
Thanks & Regards
Prabs |
|
Back to top |
|
|
|