Routine to obtain information about the program being executed author: P J Knight, CCFE, Culham Science Centre progid(0:10) : output string array : Strings containing useful info This subroutine uses system calls to identify the user, date, machine etc. for the present run, and stores the information in a character string array. !
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=110), | dimension(0:10) | :: | progid |
subroutine inform(progid)
!! Routine to obtain information about the program being executed
!! author: P J Knight, CCFE, Culham Science Centre
!! progid(0:10) : output string array : Strings containing useful info
!! This subroutine uses system calls to identify the user, date,
!! machine etc. for the present run, and stores the information
!! in a character string array.
!! !
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
use constants, only: nout
implicit none
! Arguments
character(len=110), dimension(0:10) :: progid
! Local variables
character(len=10) :: progname
character(len=98) :: executable
character(len=*), parameter :: progver = & ! Beware: keep exactly same format...
'3.1.0 Release Date :: 2024-03-21'
character(len = 50) :: dt_time
character(len=72), dimension(10) :: id
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Program name
progname = 'PROCESS'
call get_command_argument(0, executable)
call get_DDMonYYTimeZone(dt_time)
id(1) = trim(dt_time) ! values(3)//"/"// values(2)//"/"// values(1) ! 5 6 7!date
call getlog(id(2)) ! Get user ID
call hostnm(id(3)) ! Get host name
call getcwd(id(4)) ! Get current working directory
! Annotate information and store in PROGID character array
! for use in other program units via the routine argument
progid(1) = ' Program : ' // executable
progid(2) = ' Version : ' // progver
progid(3) = 'Date/time : ' // id(1)
progid(4) = ' User : ' // id(2)
progid(5) = ' Computer : ' // id(3)
progid(6) = 'Directory : ' // id(4)
! Summarise most useful data, and store in progid(0)
progid(0) = trim(progname) // ' ' // trim(progver(:7)) // &
' : Run on ' // trim(id(1)) // ' by ' // trim(id(3))
end subroutine inform