- Community Home
- >
- Servers and Operating Systems
- >
- Operating System - OpenVMS
- >
- Re: DCL question
-
- Forums
-
- Advancing Life & Work
- Advantage EX
- Alliances
- Around the Storage Block
- HPE Ezmeral: Uncut
- OEM Solutions
- Servers & Systems: The Right Compute
- Tech Insights
- The Cloud Experience Everywhere
- HPE Blog, Austria, Germany & Switzerland
- Blog HPE, France
- HPE Blog, Italy
- HPE Blog, Japan
- HPE Blog, Middle East
- HPE Blog, Russia
- HPE Blog, Saudi Arabia
- HPE Blog, South Africa
- HPE Blog, UK & Ireland
-
Blogs
- Advancing Life & Work
- Advantage EX
- Alliances
- Around the Storage Block
- HPE Blog, Latin America
- HPE Blog, Middle East
- HPE Blog, Saudi Arabia
- HPE Blog, South Africa
- HPE Blog, UK & Ireland
- HPE Ezmeral: Uncut
- OEM Solutions
- Servers & Systems: The Right Compute
- Tech Insights
- The Cloud Experience Everywhere
-
Information
- Community
- Welcome
- Getting Started
- FAQ
- Ranking Overview
- Rules of Participation
- Tips and Tricks
- Resources
- Announcements
- Email us
- Feedback
- Information Libraries
- Integrated Systems
- Networking
- Servers
- Storage
- Other HPE Sites
- Support Center
- Aruba Airheads Community
- Enterprise.nxt
- HPE Dev Community
- Cloud28+ Community
- Marketplace
-
Forums
-
Blogs
-
Information
-
English
- 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
- Email to a Friend
- 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
- Email to a Friend
- Report Inappropriate Content
03-30-2010 01:21 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- 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
- Email to a Friend
- 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
- Email to a Friend
- 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
- Email to a Friend
- 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
- Email to a Friend
- 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
- Email to a Friend
- 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
- Email to a Friend
- 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
- Email to a Friend
- 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.
Hewlett Packard Enterprise International
- Communities
- HPE Blogs and Forum
© Copyright 2021 Hewlett Packard Enterprise Development LP