program pwinput character cFile*80 character cPTN*3 /'PTN'/ character cPTR*3 /'PTR'/ character cPWN*3 /'PWN'/ character cPWR*3 /'PWR'/ character cValPTN*2 character cValPTR*2 character cValPWN*2 character cValPWR*2 character cSay*6 /'pwloop'/ logical bOpen logical bOpenFile include 'dirspec.h' include 'openfile.h' !------- Start values for parameters PWR0 = -1. PWN0 = 0. !------- Increments for parameters dPWR = .1 dPWN = .1 !------- ! The maximum loop index for each parameter is stored in the symbols ! cPTN and cPTR. These symbols are defined in the bash script 'pwscript'. ! If they are not defined, exit with status code 2 (ERROR). if (iGetSymbol(cPTN,cValPTN) .eq. 0) call Say(cSay,'E','PTN','not defined') if (iGetSymbol(cPTR,cValPTR) .eq. 0) call Say(cSay,'E','PTR','not defined') !------- ! Read the maximum loop index from string into integer variables ! The loop index runs from 0 to iValPTN and 0 to iValPTR respectively. read (cValPTN,'(I2.2)') iValPTN read (cValPTR,'(I2.2)') iValPTR !------- ! The current value of the loop index is stored in symbols cPWN and cPWR ! If these symbols exist then read them. If any one of the symbols does not ! exist then initialize the loop variables. ! Note that iValPWN corresponds to the inner loop and iValPWR to the outer loop. if (iGetSymbol(cPWN,cValPWN) .eq. 0 .or. & iGetSymbol(cPWR,cValPWR) .eq. 0) then !------- ! Initialize all loop indices to their maximum value. iValPWN = iValPTN iValPWR = iValPTR else read (cValPWN,'(I2)') iValPWN read (cValPWR,'(I2)') iValPWR end if iValPWN = iValPWN+1 ! Increase inner loop index if (iValPWN .gt. iValPTN) then ! If out of range iValPWN = 0 ! .. reset to zero iValPWR = iValPWR+1 ! .. increment outer loop index end if if (iValPWR .gt. iValPTR) then iValPWR = 0 end if !------- ! Calculate the values of all parameters. PWN = PWN0+iValPWN*dPWN PWR = PWR0+iValPWR*dPWR i = iFilePath(cEnvi//'temp',0,' ','ipsg2.input',cFile) i = OPN__TEXT+OPN__REOPEN+OPN__UNKNOWN bOpen = bOpenFile(i,iU,cFile,iRec) if (bOpen) then write (iU,'(A)') 'NO' write (iU,'(A)') '18' write (iU,'(A)') '-2.5' write (iU,'(A)') 'velocity' write (iU,'(A)') 'Nagoya' write (iU,'(A)') 'NO' if (PWN .lt. 0) then write (iU,'(F5.2)') PWN else write (iU,'(F4.2)') PWN end if if (PWR .lt. 0) then write (iU,'(F5.2)') PWR else write (iU,'(F4.2)') PWR end if write (iU,'(A)') 'NO' write (iU,'(A)') '4' write (iU,'(A)') '9' write (iU,'(A)') 'all' write (iU,'(A)') '5' write (iU,'(A)') '180' write (iU,'(A)') '90' write (iU,'(A)') '1895' write (iU,'(A)') '3' write (iU,'(A)') 'UL' write (iU,'(A)') 'NO' write (iU,'(A)') '2449780.5' write (iU,'(A)') '320' iU = iFreeLun(iU) end if write (cValPWN,'(I2.2)') iValPWN write (cValPWR,'(I2.2)') iValPWR i = iSetSymbol(cPWN,cValPWN,1) i = iSetSymbol(cPWR,cValPWR,1) if (bOpen) then call Say(cSay,'S','STOP',' ') ! Exit code 1 else call Say(cSay,'W','STOP',' ') ! Exit code 0 end if end