- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Replacement of arguments in program declaratio...
Operating System - HP-UX
1752325
Members
5792
Online
108786
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Discussions
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- 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
09-25-2000 09:20 AM
09-25-2000 09:20 AM
First of all, to those folks hard at work answering to sometimes not-so-brilliant questions,Thank you all!
Anyway, this is reposting of my question on the usage of arguments on program declaration line (in F77). I was little surprise that this was possible in fortran at all at first. However, I was even more perplexed to know that this operation is not supported in F90 (which I have now) anymore. As I understand, this operation is replaced with "IGETARG" and "IARGC". For single command line argument, this seem to work fine. However, is there anyway to set these to intrinsic functions for multiple command line arguments?
Again, what I like to do is to use
program MAIN (arg1,arg2,arg3..etc) <--F77
in F90.
Anyway, this is reposting of my question on the usage of arguments on program declaration line (in F77). I was little surprise that this was possible in fortran at all at first. However, I was even more perplexed to know that this operation is not supported in F90 (which I have now) anymore. As I understand, this operation is replaced with "IGETARG" and "IARGC". For single command line argument, this seem to work fine. However, is there anyway to set these to intrinsic functions for multiple command line arguments?
Again, what I like to do is to use
program MAIN (arg1,arg2,arg3..etc) <--F77
in F90.
Solved! Go to Solution.
- Tags:
- f90
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2000 10:56 AM
09-25-2000 10:56 AM
Solution
Accessing Command-Line Arguments
HP FORTRAN 77 extends the PROGRAM statement to enable access to
command-line arguments. This extension is not available in HP Fortran
90. However, an HP Fortran 90 program can nevertheless access
command-line arguments by calling the IGETARG and IARGC intrinsics.
For example, the following command line invokes the program fprog with
arguments:
fprog arg1 another arg 222
HP-UX captures the entire command line and makes the following strings
available to your program:
arg1 another arg 222
To access these arguments, your program must call the IGETARG and IARGC
intrinsics. IGETARG (available either as a function or as a subroutine)
gets a specific command-line argument. IARGC returns the number of
arguments on the command line.
The following program illustrates how to use both intrinsics:
PROGRAM test_igetarg
PARAMETER (arg_num = 1)
! arg_str is the character array to be written to
! by IGETARG
CHARACTER(LEN=30) :: arg_str
! IGETARG returns number of characters read within
! the specified parameter
! arg_num is the position of the desired argument in the
! the command line (the name by which the program
was invoked is 0)
! arg_str is the character array in which the argument
! will be written
! 30 is the number of characters to write to arg_str
PRINT *, IGETARG(arg_num, arg_str, 30)
PRINT *,arg_str
! IARGC returns the total number of arguments on the
! command line
PRINT *, IARGC()
END
If this program is compiled and invoked by the name a.out in the
following command line:
a.out perambulation of a different sort
it produces the output:
13 perambulation 5
For more information about the IGETARG and IARGC intrinsics, see the HP
Fortran 90 Programmer's Reference, Chapter 11. You can also use the
GETARG intrinsic to return command-line arguments. GETARG is also
available as a libU77 routine; see the HP Fortran 90 Programmer's
Reference, Chapter 12.)
If the above does stil not really answer your question, I'll get Andy Bennett our Program specialist to reply tomorrow pm if he can .... he's out am BST
HP FORTRAN 77 extends the PROGRAM statement to enable access to
command-line arguments. This extension is not available in HP Fortran
90. However, an HP Fortran 90 program can nevertheless access
command-line arguments by calling the IGETARG and IARGC intrinsics.
For example, the following command line invokes the program fprog with
arguments:
fprog arg1 another arg 222
HP-UX captures the entire command line and makes the following strings
available to your program:
arg1 another arg 222
To access these arguments, your program must call the IGETARG and IARGC
intrinsics. IGETARG (available either as a function or as a subroutine)
gets a specific command-line argument. IARGC returns the number of
arguments on the command line.
The following program illustrates how to use both intrinsics:
PROGRAM test_igetarg
PARAMETER (arg_num = 1)
! arg_str is the character array to be written to
! by IGETARG
CHARACTER(LEN=30) :: arg_str
! IGETARG returns number of characters read within
! the specified parameter
! arg_num is the position of the desired argument in the
! the command line (the name by which the program
was invoked is 0)
! arg_str is the character array in which the argument
! will be written
! 30 is the number of characters to write to arg_str
PRINT *, IGETARG(arg_num, arg_str, 30)
PRINT *,arg_str
! IARGC returns the total number of arguments on the
! command line
PRINT *, IARGC()
END
If this program is compiled and invoked by the name a.out in the
following command line:
a.out perambulation of a different sort
it produces the output:
13 perambulation 5
For more information about the IGETARG and IARGC intrinsics, see the HP
Fortran 90 Programmer's Reference, Chapter 11. You can also use the
GETARG intrinsic to return command-line arguments. GETARG is also
available as a libU77 routine; see the HP Fortran 90 Programmer's
Reference, Chapter 12.)
If the above does stil not really answer your question, I'll get Andy Bennett our Program specialist to reply tomorrow pm if he can .... he's out am BST
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP