Specialty Forums
Security and Virus
General Hardware
CPUs/Overclocking
Networking
Digital Photo/Video
Office Software
PC Gaming
Console Gaming
Programming
Database
Web Development
Digital Home

General Forums
Windows XP
Windows Vista
Windows 95/98
Windows Me
Windows NT
Windows 2000
Win Server 2008
Win Server 2003
Windows 3.1
Linux
PDAs
BeOS
Novell Netware
OpenVMS
Solaris
Disk Op. System
Unix
Mac
OS/2

Drivers
Driver Scan
Driver Forum

Software
Automatic Updates

BIOS Updates

My Computing.Net

Solution Center

Free IT eBook

Howtos

Site Search

Message Find

RSS Feeds

Install Guides

Data Recovery

About

Home
Reply to Message Icon Go to Main Page Icon

F$INTEGER problem

Original Message
Name: amsedelm
Date: May 14, 2008 at 13:27:54 Pacific
Subject: F$INTEGER problem
OS: Open/VMS
CPU/Ram: not sure
Model/Manufacturer: HP Alpha Server
Comment:
In DCL: how do I get only the numeric value when I use the lexical F$INTEGER? Because the output shows numeric, octal, and hex. Or, do I just cut out the Hex and Octal fields? Is there any easier way to add numbers? I'm a unix guy learning DCL.
Thanks.
Mike

Michael Ledesma
System Administrator
Petro Heating Oil Svc's


Report Offensive Message For Removal


Response Number 1
Name: Joseph.Huber
Date: May 15, 2008 at 00:07:54 Pacific
Subject: F$INTEGER problem
Reply: (edit)
What do You really mean ?
The result of i=f$integer(x) is an assignement/converion of x to a numerical symbol i.
Only the SHOW SYMBOL i displays the symbol in the 3 radices.

If You want to see only the decimal value, use
write sys$output symbol
-or-
use the f$fao lexical function to display in any format wanted.


Report Offensive Follow Up For Removal

Response Number 2
Name: amsedelm
Date: May 15, 2008 at 06:45:43 Pacific
Subject: F$INTEGER problem
Reply: (edit)
I'm writing a program to calculate epoch time from a date stamp. I used the f$integer lexical to convert the values to numeric so I could add them. Otherwise they were being concatenated. That's the only way I could figure it out. But, I'll try your suggestion. I'm new at DCL.
Thanks for your help.
Mike

Michael Ledesma
System Administrator
Petro Heating Oil Svc's


Report Offensive Follow Up For Removal

Response Number 3
Name: Joseph.Huber
Date: May 15, 2008 at 10:43:45 Pacific
Subject: F$INTEGER problem
Reply: (edit)
An example to calculate seconds since midnight:
$ times="19:11:03"
$ h = f$integer(f$element(0,":",times))
$ m = f$integer(f$element(1,":",times))
$ s = f$integer(f$element(2,":",times))
$ seconds = (h*3600) + (m*60) + s
$ write sys$output h,":",m,":",s,"=",seconds

$! date:
$ dates="1-JUN-2008"
$ dates = f$edit(dates,"UPCASE")
$ day=f$integer(f$cvtime(dates,"COMPARISON","DAY"))
$ mon=f$integer(f$cvtime(dates,"COMPARISON","MONTH"))
$ year=f$integer(f$cvtime(dates,"COMPARISON","YEAR"))
$ seconds=f$cvtime(dates,"COMPARISON","SECONDOFYEAR")
$ write sys$output dates,"=",day," ",mon," ",year,"=",seconds," sec"


Note: correct calculation of seconds since epoch is not easy to do in DCL, since You would have to take into account the leap-year algorithm.

A more appropriate way to write a small program in a higher level language: get the date string from the command-line, use the ascii-to-numeric time functions, then convert the resulting numerical time to a string, output the string in a DCL symbol.

See some examples in my VMS utilities page at
http://wwwvms.mppmu.mpg.de/~huber/u...

Look for the *time_t routines, and

$ h = f$integer(f$element(0,":",times))
$ m = f$integer(f$element(1,":",times))
$ s = f$integer(f$element(2,":",times))
$ seconds = (h*3600) + (m*60) + s
$ write sys$output h,":",m,":",s,"=",seconds

$! date:
$ dates="1-JUN-2008"
$ dates = f$edit(dates,"UPCASE")
$ day=f$integer(f$cvtime(dates,"COMPARISON","DAY"))
$ mon=f$integer(f$cvtime(dates,"COMPARISON","MONTH"))
$ year=f$integer(f$cvtime(dates,"COMPARISON","YEAR"))
$ seconds=f$cvtime(dates,"COMPARISON","SECONDOFYEAR")
$ write sys$output dates,"=",day," ",mon," ",year,"=",seconds," sec"


Note: correct calculation of seconds since epoch is not easy to do in DCL, since You would have to take into account the leap-year algorithm.

A more appropriate way to write a small program in a higher level language: get the date string from the command-line, use the ascii-to-numeric time functions, then convert the resulting numerical time to a string, output the string in a DCL symbol.

See some examples in my VMS utilities page at
http://wwwvms.mppmu.mpg.de/~huber/u...

Look for the *time_t routines, and vmstime_to_time_t_m.C in the main/ directory.


Report Offensive Follow Up For Removal

Response Number 4
Name: amsedelm
Date: May 16, 2008 at 07:53:42 Pacific
Subject: F$INTEGER problem
Reply: (edit)
Thanks, Joseph. You have alot of good stuff there. Much appreciated.
Mike

Michael Ledesma
System Administrator
Petro Heating Oil Svc's


Report Offensive Follow Up For Removal




Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: F$INTEGER problem

Comments:

 
  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 


Data Recovery Software




how to setup call of duty to joytok

WindowsME / HotMail Problem

Corrupt memory

Convert fat32 to Ntfs

Best WinMo phone of 2008


The information on Computing.Net is the opinions of its users. Such opinions may not be accurate and they are to be used at your own risk. Computing.Net cannot verify the validity of the statements made on this site. Computing.Net and Computing.Net, LLC hereby disclaim all responsibility and liability for the content of Computing.Net and its accuracy.
PLEASE READ THE FULL DISCLAIMER AND LEGAL TERMS BY CLICKING HERE

All content ©1996-2007 Computing.Net, LLC