I needed access to more than just the program name.
I first call CMPROGNM@ to get the executable name.
I then executed the following sequence, but it didn't pick up the second command line argument
if(cmnargs@() .ge. 1) then
! --- we have a copmmand line argument. Assume it is the COALCNFG.DAT pathname
call get_command_argument(1,CONFIG,l,istat)
print *,'L,istat=',l,istat
print *,'New coalcnfg.dat file is: ',trim(CONFIG)
endif
This yields a length of zero (L=0) and a status (ISTAT = 1 [error])
However, if I add the same call, but attempt to pick up the command name first, this call yields the L=0 and ISTAT=1, but the second yields L=20 (proper length), ISTAT=0 (success), and properly returns the second command line argument.
if(cmnargs@() .ge. 1) then
! --- we have a copmmand line argument. Assume it is the COALCNFG.DAT pathname
call get_command_argument(0,CONFIG,l,istat)
print *,'L,istat=',l,istat
call get_command_argument(1,CONFIG,l,istat)
print *,'L,istat=',l,istat
print *,'New coalcnfg.dat file is: ',trim(CONFIG)
endif
This makes no sense to me, but there has to be a reason! Bill