- 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
Discussions
Discussions
Forums
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
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.