I've written a program in F90 which reads in a few input arrays from text files and then combines them through a function to a single output file. One of the input files is named for the day the data was collected using MMDDYY.tuvr and the output file is then named MMDDYY.fxi . I'd like to be able to input the MMDDYY of the data in the command line when running the program instead of having to manually change the code and compile each time, which is why I'm attempting to use getarg, but I cannot seem to make it work properly. The code im attempting to use is listed below (just shows the get arg and the open commands and not the entire program since this is where I'm having trouble):
CHARACTER(len=20) :: arg, tuvrname, fxiname
CALL getarg(1, arg)
IF(LEN_TRIM(arg) == 0) THEN
print*,'No date provided'
STOP
ELSE
tuvrname = TRIM(arg)'.tuvr'
fxiname = TRIM(arg).'fxi'
ENDIF
OPEN(1, file = tuvrname, status='old', action='read')
....
OPEN(4, file = fxiname, status='replace', action='write')
I also tried just using two separate getarg commands and entering MMDDDYY.tuvr MMDDYY.fxi in the command line and the program ran, but it could not seem to find my TUVR file as the output was empty.