- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Re: DCL question
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2010 01:10 AM
03-30-2010 01:10 AM
business_date = f$edit(p1,"trim,upcase")
begin_date = business_date
end_date = business_date
month = f$extract(4,2,business_date)
month = month -1
begin_date[4,2]= "''month'"
show symbol begin_date
on running this COM file, when the input is 20100321, the output is 20102 21.
what happens is month 03 - 1 = 2.
what should i do, if i need 02, instead of 2, to look the output as 20100221.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2010 01:21 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2010 02:39 AM
03-30-2010 02:39 AM
Re: DCL question
$ If f$len(Month) .lt. 2 then Month = "0''Month'"
Dave
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2010 03:35 AM
03-30-2010 03:35 AM
Re: DCL question
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2010 03:43 AM
03-30-2010 03:43 AM
Re: DCL question
I have taken care of these cases.
if the month 01, i change the year and month as well.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2010 05:00 AM
03-30-2010 05:00 AM
Re: DCL question
have you considered / do you have control over the inpt date format?
If you can input 2010031 as 21-mar-2010, then you have the full functionality of F$CVTIME available. Which includes all kinds of date reckoning.
fwiw
Proost.
Have one on me.
jpe
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2010 12:57 PM
03-30-2010 12:57 PM
Re: DCL question
Rather than reimplement the convoluted logic of date calculations, I recommend you keep your dates in VMS ABSOLUTE format and use F$CVTIME to do the date arithmetic.
For example, the day before DATE is:
$ day_before=F$CVTIME("''date'-1-","ABSOLUTE","DATE")
Once you've found your target date, you can convert it to julian format with:
$ jdate=F$CVTIME(date,,"DATE")-"-"-"-"
Converting a julian date to an absolute date is:
$ date=F$FAO("!UL-!AS-!4AS",F$INTEGER(F$EXTRACT(6,2,jdate)),F$ELEMENT(F$EXTRACT(4,2,jdate),"|","|JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC|"),F$EXTRACT(0,4,jdate))
To get DAY, MONTH and YEAR as numbers:
$ DAY=F$INTEGER(F$CVTIME(DATE,,"DAY"))
$ MONTH=F$INTEGER(F$CVTIME(DATE,,"MONTH"))
$ YEAR=F$INTEGER(F$CVTIME(DATE,,"YEAR"))
To convert DAY, MONTH and YEAR back to julian format, use F$FAO:
$ jdate=F$FAO("!4ZL!2ZL!2ZL",YEAR,MONTH,DAY)
In the control string for F$FAO "!" means a formatting directive follows, the next number is the field width and "ZL" means "Zero filled Longword integter"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2010 03:57 PM
03-30-2010 03:57 PM
Re: DCL question
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2010 07:56 PM
03-30-2010 07:56 PM
Re: DCL question
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2010 12:37 AM
04-07-2010 12:37 AM
Re: DCL question
month_str = "00" + month
month_str =f$extract(f$length(month_str)-2,f$length(month_str),month_str)
! will always give two digits. if month is digit then 0 is displayed along els eif two, then only the two digit month number is dispalyed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2010 09:23 AM
04-07-2010 09:23 AM
Re: DCL question
x = f$fao("!2ZW", month)
Timekeeping and time values are an area that almost certainly will encounter problems when manually parsing and manipulating values; time and timekeeping does look simple, but it's replete with corner cases. Whether involving month or year boundary cases, or with leap year, with the two switches related to daylight saving time, calculations with UTC or such, or with centuries. These are only some of the errors I've encountered, too.
Use the system routines to manage time and time values whenever you can. Don't roll your own where you can avoid it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2010 09:58 AM
04-07-2010 09:58 AM
Re: DCL question
The sites I have encountered which had their own "smart" time routines; and when they ran into some "issue" I was called in to find the cause -- and explain !!!
Bottom line:
a number of REALLY smart guys/galls have spent serious effort to get it right - USE SYSTEM supplied date-time functions!
Proost.
Have one on me.
jpe