Thanks for these explanations.
Here is a MWE :
Module treat_files_list.f90 :
PROGRAM treat_files_list
USE grid_ames_mod
USE struct_ames_mod
IMPLICIT NONE
CHARACTER(LEN=300) :: temp_string, temp_string2
CHARACTER(LEN=41) :: temp_string4
CHARACTER(LEN=28) :: temp_string5
CHARACTER(LEN=14) :: temp_string6
CHARACTER(LEN=120) :: temp_string80
CHARACTER(LEN=250) :: filein,list_files,tmp_list
CHARACTER(LEN=100) :: cmoismin,cmoismax,cheuremin,cheuremax ,temp_string3
CHARACTER(LEN=100) :: rep_data,rep_so,chaine,chaine2,rep_lo,file_lo
CHARACTER(LEN=50) :: link
CHARACTER(LEN=8) :: tdate
CHARACTER(LEN=5) :: coltemp,col1
CHARACTER(LEN=7) :: col2, col5, col6, col8
CHARACTER(LEN=7) :: col10,col9
CHARACTER(LEN=10) :: col11,col7
CHARACTER(LEN=4) :: mois,annee
CHARACTER(LEN=6) :: col4
CHARACTER(LEN=8) :: col3
CHARACTER(LEN=10) :: ttime
CHARACTER(LEN=5) :: tzone
INTEGER, DIMENSION(8) :: tvalues
CHARACTER(LEN=200) :: screen,line,line2
INTEGER :: i,j,indice,idatemesure,idatemesuremax,idatemesuremin,nblcomment,ifdatemesure
INTEGER :: unit,ios,ios2,iosres,debug,nbfile,ios3,lecture,ulog,nbfiles,ifile,temp_int,temp_int2
type(grid_ames) :: sortie_asc,temp_ames
type(struct_ames) :: sortie_ames
LOGICAL :: retour
REAL :: temp_real
COMMON screen,rep_so,debug
COMMON rep_lo,file_lo,ulog
!lecture du fichier temporaire devant contenir la liste des fichiers de donnees a traiter
call getarg(1,tmp_list)
nbfiles=0
debug=1
ifile=0
!ouverture liste des fichiers asc a traiter
OPEN( UNIT=2, &
FILE=tmp_list, &
FORM="formatted", &
ACCESS="sequential", &
STATUS="old", &
ACTION="read", &
POSITION="rewind", &
IOSTAT=ios3 )
READ(2,IOSTAT=ios3, FMT='(A)') filein
if (ios3 /= 0 ) then
screen="Impossible d ouvrir le fichier temporaire des fichiers de donnees a traiter : "//adjustl(trim(filein))
retour=printl()
STOP
endif
rep_data=filein
screen="DATA DIRECTORY : "//rep_data
retour=printl()
mois=""
annee=""
READ(2,IOSTAT=ios3, FMT='(I)') nbfiles
READ(2,IOSTAT=ios3,FMT='(I)') debug
READ(2,IOSTAT=ios3,FMT=*) mois
READ(2,IOSTAT=ios3,FMT=*) annee
!creation du fichier de sortie ames
OPEN( UNIT=14, &
FILE="ohto"//trim(adjustl(annee(3:4)))//trim(adjustl(mois))//".anl", &
FORM="formatted", &
ACCESS="sequential", &
STATUS="unknown", &
ACTION="readwrite", &
POSITION="rewind", &
IOSTAT=iosres )
if (iosres /= 0 ) then
screen="Impossible de creer le fichier des grilles"
retour=printl()
STOP
endif
READ(2,IOSTAT=ios3, FMT='(A)') filein
ALLOCATE(sortie_ames%grids_ames(nbfiles))
Module grid_ames_mod.f90
MODULE grid_ames_mod
IMPLICIT NONE
CONTAINS
type GRID_AMES
CHARACTER(LEN=14) :: datemesure
CHARACTER(LEN=4) :: annee
CHARACTER(LEN=4) :: yearmes
CHARACTER(LEN=10) :: monthmes
CHARACTER(LEN=10) :: cmois
CHARACTER(LEN=10) :: cheure
CHARACTER(LEN=2) :: daymes
CHARACTER(LEN=2) :: deb_heuremes
CHARACTER(LEN=2) :: deb_minutemes
CHARACTER(LEN=2) :: deb_secondemes
CHARACTER(LEN=2) :: fin_heuremes
CHARACTER(LEN=2) :: fin_minutemes
CHARACTER(LEN=2) :: fin_secondemes
CHARACTER(LEN=10) :: dureemes
CHARACTER(LEN=10) :: julianday
CHARACTER(LEN=10) :: deb_alt
CHARACTER(LEN=10),DIMENSION(15) :: top
CHARACTER(LEN=50),DIMENSION(:,:),pointer :: tabMesures=>null()
CHARACTER(LEN=10) :: v_resolution
CHARACTER(LEN=10) :: wave_length
CHARACTER(LEN=10) :: nb_shot
CHARACTER(LEN=10) :: frequency
end type GRID_AMES
END MODULE grid_ames_mod
Module head_ames_mod.f90
MODULE head_ames_mod
IMPLICIT NONE
CONTAINS
type HEAD_AMES
CHARACTER(LEN=12) :: station
CHARACTER(LEN=12) :: instrument
CHARACTER(LEN=40) :: instrument2
CHARACTER(LEN=20) :: pi
CHARACTER(LEN=40) :: pi2
CHARACTER(LEN=12) :: specie
CHARACTER(LEN=100) :: date
CHARACTER(LEN=50) :: datemin, datemax
CHARACTER(LEN=100) :: lab
CHARACTER(LEN=100) :: head_line
INTEGER :: julianday
CHARACTER(LEN=5) :: altitude
CHARACTER(LEN=5) :: latitude
CHARACTER(LEN=5) :: longitude
end type HEAD_AMES
END MODULE head_ames_mod
Module struct_ames_mod.f90
MODULE struct_ames_mod
IMPLICIT NONE
CONTAINS
USE head_ames_mod
USE grid_ames_mod
type STRUCT_AMES
CHARACTER(LEN=12) :: chaine
type(grid_ames),DIMENSION(:),pointer :: grids_ames=>null()
type(head_ames) :: head
end type STRUCT_AMES
END MODULE struct_ames_mod
Makefile
#!/bin/bash
OBJ = head_ames_mod.o grid_ames_mod.o struct_ames_mod.o treat_files_list.o
FC = pgf90
FLAGS =
.SUFFIXES : .f90
all: treat_files_list
clean:
rm -f *.o *.mod
.f90.o:
$(FC) $(FLAGS) -c head_ames_mod.f90
$(FC) $(FLAGS) -c grid_ames_mod.f90
$(FC) $(FLAGS) -c struct_ames_mod.f90
$(FC) $(FLAGS) -c treat_files_list.f90
treat_files_list: $(OBJ)
$(FC) -o treat_files_list $(OBJ)
Working compilation :
pgf90 --version
pgf90 13.10-0 64-bit target on x86-64 Linux -tp sandybridge
The Portland Group - PGI Compilers and Tools
Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved.
Not working compilation
pgf90 --version
pgf90 (aka nvfortran) 21.9-0 64-bit target on x86-64 Linux -tp zen
PGI Compilers and Tools
Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
Error message
vFortran$ make
pgf90 -c head_ames_mod.f90
pgf90 -c grid_ames_mod.f90
pgf90 -c struct_ames_mod.f90
pgf90 -c treat_files_list.f90
pgf90 -o treat_files_list head_ames_mod.o grid_ames_mod.o struct_ames_mod.o treat_files_list.o
/usr/bin/ld: treat_files_list.o: in function MAIN_': vFortran/treat_files_list.f90:154: undefined reference to
grid_ames_mod___grid_ames__td_’
/usr/bin/ld: vFortran/treat_files_list.f90:154: undefined reference to `grid_ames_mod___grid_ames__td_’
make: *** [Makefile:19: treat_files_list] Error 2