View previous topic :: View next topic |
Author |
Message |
pgorthi Beginner
Joined: 13 Sep 2004 Posts: 33 Topics: 16
|
Posted: Thu Nov 11, 2004 5:35 am Post subject: How convert mm/dd/yy to nov12th2004 in easytrieve? |
|
|
Hi,
how to convert mm/dd/yy to jan 10th 2004 in easytrieve. this format i want to display in title. using our own logic are any other predefined date functions is their like sysdate.
regards,
pgorthi |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12372 Topics: 75 Location: San Jose
|
Posted: Thu Nov 11, 2004 6:17 am Post subject: |
|
|
pgorthi,
Easytrieve has a DATECONV routine which converts a date-in-one format to any other date format. Look up the reference manual for a detailed explanation of the macro
But you only need this for expanding the 2 digit year to 4 digit year. You can spell out the month name using a simple CASE function. check this link for an example.
http://www.mvsforums.com/helpboards/viewtopic.php?t=1213&highlight=case+ca7
The following example gives you the desired results.
Code: |
WS-DATE W 08 A
WS-MM WS-DATE 02 A
WS-DD1 WS-DATE +3 01 A
WS-DD2 WS-DATE +4 01 A
WS-YY WS-DATE +6 02 N 0
WS-OUTPUT W 13 A
MONTH-NAME WS-OUTPUT 03 A
OUT-DD1 WS-OUTPUT +04 01 A
OUT-DD2 WS-OUTPUT +05 01 A
OUT-SUFFIX WS-OUTPUT +06 02 A
OUT-CC WS-OUTPUT +09 02 A
OUT-YY WS-OUTPUT +11 02 A
JOB
WS-DATE = 01/10/04
WS-OUTPUT = ' '
PERFORM GET-MONTH
PERFORM GET-SUFFIX
PERFORM GET-YEAR
DISPLAY 'THE DATE IS : ' WS-OUTPUT
GET-MONTH. PROC
CASE WS-MM
WHEN '01'
MONTH-NAME = 'JAN'
WHEN '02'
MONTH-NAME = 'FEB'
WHEN '03'
MONTH-NAME = 'MAR'
WHEN '04'
MONTH-NAME = 'APR'
WHEN '05'
MONTH-NAME = 'MAY'
WHEN '06'
MONTH-NAME = 'JUN'
WHEN '07'
MONTH-NAME = 'JUL'
WHEN '08'
MONTH-NAME = 'AUG'
WHEN '09'
MONTH-NAME = 'SEP'
WHEN '10'
MONTH-NAME = 'OCT'
WHEN '11'
MONTH-NAME = 'NOV'
WHEN '12'
MONTH-NAME = 'DEC'
END-CASE
END-PROC
GET-SUFFIX. PROC
OUT-DD1 = WS-DD1
OUT-DD2 = WS-DD2
CASE WS-DD2
WHEN '1'
OUT-SUFFIX = 'ST'
WHEN '2'
OUT-SUFFIX = 'ND'
WHEN '3'
OUT-SUFFIX = 'RD'
OTHERWISE
OUT-SUFFIX = 'TH'
END-CASE
END-PROC
GET-YEAR. PROC
OUT-YY = WS-YY
IF WS-YY > 50 AND WS-YY <= 99
OUT-CC = '19'
ELSE
OUT-CC = '20'
END-IF
END-PROC
/*
|
Hope this helps...
Cheers
kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
|
|