! KEY_NAMES.F90 - Illustrates using a type structure and a ! subroutine defined within a module. ! This requires NAME_SSN.F90. It is easiest to compile ! both program together, using: ! df /exe:keynames.exe name_ssn.f90 keynames.f90 ! If you had compiled name_ssn.f90 separately, the command to build the ! executable would be: ! df keynames.f90 name_ssn.obj ! PROGRAM key_names ! input last name, first name, social security number ! verify SSN to be a number ! calculate ssn_key (let's pretend its the key of a Database) ! print out our information, get verification from user. use name_ssn, verify => check_ssn print *, 'Enter last name' read *, in_lastn print *, 'Enter first name' read *, in_firstn msg = 'Social security number OK' do while (msg .NE. ' ') print *, 'Enter social security number, without hyphens (-)' read *, in_ssn call verify (in_ssn,msg) end do full_name = trim(in_firstn)//' '//trim(in_lastn) print *, full_name file_key%ssn = in_ssn file_key%lname = in_lastn file_key%fname = in_firstn print *, 'Database key is ',file_key end program key_names