************************************************************************ * * * * * ----------------------- * * this is file COMPS.FTN * * ----------------------- * * * * * * Compilation command line: * * * * MCR>F77 COMPS=COMPS ! normal command line * * * * * * Task build command line: * * * * MCR>TKB COMPS/FP=COMPS,ddn:[1,1]F77FCS/LB * * / * * MAXBUF=512 * * // * * * * * ************************************************************************ * ------------------------------------------------------------------ PROGRAM COMP * ------------------------------------------------------------------ * * Name: COMParsion * * Computer: LSI-11/23 & LSI-11/73 * Operating System: RSX-11M V4.2 BL38B * Language: FORTRAN-77 * Original Programmer: R. E. K. Neitzel * Process Control Applications * 312 Laveta Pass * Golden, CO 80401 * * * Date Written: 10/31/86 * * * Revisions: Programmer Date Description * ---------- -------- --------------------- * * * Quality Assurance * Software Control no.: * * * Description: * This program allows direct comparision of task image and packed * files. The two selected files are read one record at a time and * compared. If a difference is detected a message is printed to the CRT * and a file. The file may be printed for hardcopy recording. * * * Subroutine and function calling outline: * PAKCMP ! Source in COMPS.FTN * TSKCMP ! Source in COMPS.FTN * PRINT ! Source in COMPS.FTN * * ---Local variables--- * type name usage * ---- ---- ----- CHARACTER*1 ANSWER ! User's answers LOGICAL*1 ERROR ! Returned true if error on opening files * * * ---Executable statements begin here--- * TYPE *,' Welcome to the comparsion program' * * ---Get the file type to compare--- * 1 TYPE *,' Please enter the correct letter for the files' TYPE *,' to be compared: .[P]ak .[T]sk ' READ(5,10)ANSWER 10 FORMAT(A1) * * ---Make sure it's correct--- * IF ((ANSWER .EQ. 'P') .OR. (ANSWER .EQ. 'p')) THEN CALL PAKCMP (ERROR) ELSEIF ((ANSWER .EQ. 'T') .OR. (ANSWER .EQ. 't')) THEN CALL TSKCMP (ERROR) ELSE TYPE *,' Incorrect answer - please try again' GOTO 1 ENDIF * * ---If all went well do we print log file?--- * IF (.NOT. ERROR) THEN TYPE *,' Do you want to print out the comparision results?' TYPE *,' [Y/N] ' READ(5,10)ANSWER IF ((ANSWER .EQ. 'Y') .OR. (ANSWER .EQ. 'y')) CALL PRINT ENDIF * * ---More?--- * TYPE *,' Do you want to do another comparsion [Y/N] ' READ(5,10)ANSWER IF ((ANSWER .EQ. 'Y') .OR. (ANSWER .EQ. 'y')) GOTO 1 * END * ------------------------------------------------------------------ SUBROUTINE TSKCMP (ERROR) * ------------------------------------------------------------------ * * Name: TaSK file CoMParision * * Computer: LSI-11/23 & LSI-11/73 * Operating System: RSX-11M V4.2 BL38B * Language: FORTRAN-77 * Original Programmer: R. E. K. Neitzel * Process Control Applications * 312 Laveta Pass * Golden, CO 80401 * * * Date Written: 11/3/86 * * * Revisions: Programmer Date Description * ---------- -------- --------------------- * * * Description: * This subroutine opens the two task image files and the log file. * The task image files are read a block at a time and compared. If a * difference is found the block and byte numbers and the values are * written to the CRT and log. If the log file cannot be opened the * program is terminated, while if the task image files cannot be opened * control is returned to the main program. * * * ---Passed variables--- * type name usage * ---- ---- ----- LOGICAL*1 ERROR ! True if task files not opened * * Constants: * type name usage * ---- ---- ----- INTEGER*2 LENGTH ! Length of a block in bytes PARAMETER (LENGTH = 512) * * ---Local variables--- * type name usage * ---- ---- ----- INTEGER*2 BLOCK ! Current block number BYTE BUFF1(LENGTH)! Input buffer for file 1 BYTE BUFF2(LENGTH)! Input buffer for file 2 INTEGER*2 BYTE ! Current byte number CHARACTER*5 DEV1 ! Device for file 1 CHARACTER*5 DEV2 ! device for file 2 LOGICAL*1 DIFF ! Difference flag INTEGER*2 END ! Last character in file name INTEGER*2 ERRCNT ! Current number of differences CHARACTER*18 FILE ! File name used for opening CHARACTER*9 NAME ! File name entered INTEGER*2 SIZE ! Length of file name * * * ---Executable statements begin here--- * ERROR = .FALSE. DIFF = .FALSE. BLOCK = 0 ERRCNT = 0 * * ---Get files to be compared--- * TYPE *,' Please enter the file name: ' READ(5,1)NAME 1 FORMAT(A) * TYPE *,' On what device is the file to be tested- ' READ(5,10)DEV1 10 FORMAT(A) * TYPE *,' On what device is the master file - ' READ(5,10)DEV2 * FILE(1:5) = DEV1(1:5) SIZE = INDEX(NAME(1:9),' ') END = SIZE - 1 FILE(6:(END+6)) = NAME(1:END) FILE((END+7):(END+10)) = '.TSK' * * ---Open files--- * OPEN(UNIT=1,FILE=FILE,STATUS='OLD',RECORDTYPE='FIXED', * ACCESS='SEQUENTIAL',FORM='UNFORMATTED',ERR=800) * FILE(1:5) = DEV2(1:5) * OPEN(UNIT=2,FILE=FILE,STATUS='OLD',RECORDTYPE='FIXED', * ACCESS='SEQUENTIAL',FORM='UNFORMATTED',ERR=800) * OPEN(UNIT=3,FILE='C.C',STATUS='NEW',ACCESS='SEQUENTIAL', * RECORDTYPE='VARIABLE',FORM='FORMATTED',ERR=700) * * ---Start comparing--- * WRITE(5,15)DEV1,NAME,DEV2,NAME WRITE(3,15)DEV1,NAME,DEV2,NAME 15 FORMAT(' Comparision of ',A,' ',A,'.TSK and ',A,' ',A,'.TSK') * * ---Get next block--- * 20 READ(1,END=600)BUFF1 READ(2,END=500)BUFF2 BLOCK = BLOCK + 1 * * ---Do byte by byte comparision--- * DO 30 BYTE = 1, LENGTH * * ---Do they match--- * IF (BUFF1(BYTE) .NE. BUFF2(BYTE)) THEN DIFF = .TRUE. ! No, so set flag TYPE *,' Difference detected' WRITE(3,25)BLOCK,BYTE,BUFF1(BYTE),BUFF2(BYTE)! Write to log 25 FORMAT(' Files do not match at block ',I6, * ' byte ',I3,' 1st value',I4,' second value',I4) IF (ERRCNT .GE. 50) THEN WRITE(3,27) 27 FORMAT(' Exiting comparision - over 50 differences ', * 'detected between files.') GOTO 990 ENDIF ERRCNT = ERRCNT + 1 * ENDIF 30 CONTINUE * * ---Loop back * GOTO 20 * * ---Check if files are of equal length--- * 500 WRITE(5,510) ! Since file 2 ended before file 1, length doesn't WRITE(6,510) ! match. 510 FORMAT(' The files are not of equal length') DIFF = .TRUE. GOTO 990 * 600 READ(2,END=650)BUFF2 ! Check for another record in file 2 WRITE(5,510) ! If found lengths don't match WRITE(6,510) DIFF = .TRUE. 650 GOTO 990 * * ---Error opening log file--- * 700 TYPE *,' Cannot open logging file, exiting program' CLOSE(UNIT=1) CLOSE(UNIT=2) CLOSE(UNIT=3) CALL EXIT ! Quit program * * ---Error opening a task file--- * 800 TYPE *,' Cannot open work file(s), please try again' ERROR = .TRUE. * * ---Close files--- * 990 IF (.NOT. DIFF) THEN ! If difference flag not set WRITE(5,995) ! Write to CRT and log no differences WRITE(3,995) 995 FORMAT(' No differences were detected') ENDIF CLOSE(UNIT=1) CLOSE(UNIT=2) CLOSE(UNIT=3) RETURN END * ------------------------------------------------------------------ SUBROUTINE PAKCMP (ERROR) * ------------------------------------------------------------------ * * Name: PAcK file CoMParision * * Computer: LSI-11/23 & LSI-11/73 * Operating System: RSX-11M V4.2 BL38B * Language: FORTRAN-77 * Original Programmer: R. E. K. Neitzel * Process Control Applications * 312 Laveta Pass * Golden, CO 80401 * * * Date Written: 11/3/86 * * * Revisions: Programmer Date Description * ---------- -------- --------------------- * * * Description: * This subroutine opens the two packed files and the log file. * The packed files are read a record at a time and compared. If a * difference is found the record and byte numbers and the values are * written to the CRT and log. If the log file cannot be opened the * program is terminated, while if the packed files cannot be opened * control is returned to the main program. * * ---Passed variables--- * type name usage * ---- ---- ----- LOGICAL*1 ERROR ! Error flag * * Constants: * type name usage * ---- ---- ----- INTEGER*2 LENGTH ! length of input record in bytes PARAMETER (LENGTH = 80) * * ---Local variables--- * type name usage * ---- ---- ----- CHARACTER*80 BUFF1 ! Input buffer for file 1 CHARACTER*80 BUFF2 ! Input buffer for file 2 CHARACTER*5 DEV1 ! Device for file 1 CHARACTER*5 DEV2 ! Device for file 2 LOGICAL*1 DIFF ! Difference flag INTEGER*2 END ! Last character in file name input INTEGER*2 ERRCNT ! Current number of differences CHARACTER*18 FILE ! File name for opening INTEGER*2 LOOP ! Loop counter CHARACTER*9 NAME ! File name input BYTE OUT1(80) ! Buffer for file 1 output BYTE OUT2(80) ! Buffer for file 2 output INTEGER*2 RECORD ! Current record number INTEGER*2 SIZE ! Length of input file name * EQUIVALENCE (OUT1(1),BUFF1(1:1)) EQUIVALENCE (OUT2(1),BUFF2(1:1)) * * * ---Executable statements begin here--- * ERROR = .FALSE. DIFF = .FALSE. RECORD = 0 ERRCNT = 0 * * ---Get file names--- * TYPE *,' Please enter the file name: ' READ(5,1)NAME 1 FORMAT(A) * TYPE *,' On what device is the file being checked- ' READ(5,10)DEV1 10 FORMAT(A) * TYPE *,' On what device is the master file - ' READ(5,10)DEV2 * FILE(1:5) = DEV1(1:5) SIZE = INDEX(NAME(1:9),' ') END = SIZE - 1 FILE(6:(END+6)) = NAME(1:END) FILE((END+7):(END+10)) = '.PAK' * * ---Open files--- * OPEN(UNIT=1,FILE=FILE,STATUS='OLD',RECORDTYPE='VARIABLE', * ACCESS='SEQUENTIAL',FORM='FORMATTED',ERR=800) * FILE(1:5) = DEV2(1:5) * OPEN(UNIT=2,FILE=FILE,STATUS='OLD',RECORDTYPE='VARIABLE', * ACCESS='SEQUENTIAL',FORM='FORMATTED',ERR=800) * OPEN(UNIT=3,FILE='C.C',STATUS='NEW',ACCESS='SEQUENTIAL', * RECORDTYPE='VARIABLE',FORM='FORMATTED',ERR=700) * * ---Start comparing--- * WRITE(5,15)DEV1,NAME,DEV2,NAME WRITE(3,15)DEV1,NAME,DEV2,NAME 15 FORMAT(' Comparision of ',A,' ',A,'.PAK and ',A,' ',A,'.PAK') * * ---Get next record--- * 20 READ(1,22,END=600)BUFF1 READ(2,22,END=500)BUFF2 22 FORMAT(A) RECORD = RECORD + 1 * * ---Difference?--- * IF (BUFF1(1:80) .NE. BUFF2(1:80)) THEN DIFF = .TRUE. ! Yes, so set flag DO 30 LOOP = 1, LENGTH ! Find bytes that differ IF (OUT1(LOOP) .NE. OUT2(LOOP)) THEN TYPE *,' Diferences detected' WRITE(3,25)RECORD,LOOP,OUT1(LOOP),OUT2(LOOP) ! Write to log 25 FORMAT(' Files do not match at record ',I6, * ' byte ',I3,' 1st value',I4,' second value',I4) IF (ERRCNT .GE. 50) THEN WRITE(3,27) 27 FORMAT(' Exiting comparision - over 50 differences ', * 'detected between files.') GOTO 990 ENDIF ERRCNT = ERRCNT + 1 * ENDIF 30 CONTINUE ENDIF * * ---Loop back--- * GOTO 20 * * ---File 1 longer then file 2--- * 500 WRITE(5,510) WRITE(3,510) 510 FORMAT(' The files are not of equal length') DIFF = .TRUE. GOTO 990 * * ---Is file 2 longer then file 1?--- * 600 READ(2,22,END=650)BUFF2 ! Check if another record in file 2 WRITE(5,510) ! Yes, so lengths don't match WRITE(6,510) DIFF = .TRUE. 650 GOTO 990 * * ---Error opening log file--- * 700 TYPE *,' Cannot open logging file, exiting program' CLOSE(UNIT=1) CLOSE(UNIT=2) CLOSE(UNIT=3) CALL EXIT * * ---Error opening a packed file--- * 800 TYPE *,' Cannot open work file(s), please try again' ERROR = .TRUE. * * ---Exit--- * 990 IF (.NOT. DIFF) THEN ! If difference flag not set WRITE(5,995) ! Write to log and CRT WRITE(3,995) 995 FORMAT(' No differences detected') ENDIF CLOSE(UNIT=1) CLOSE(UNIT=2) CLOSE(UNIT=3) RETURN END * ------------------------------------------------------------------ SUBROUTINE PRINT * ------------------------------------------------------------------ * * Name: PRINT file * * Computer: LSI-11/23 & LSI-11/73 * Operating System: RSX-11M V4.2 BL38B * Language: FORTRAN-77 * Original Programmer: R. E. K. Neitzel * Process Control Applications * 312 Laveta Pass * Golden, CO 80401 * * * Date Written: 10/31/86 * * * Revisions: Programmer Date Description * ---------- -------- --------------------- * * * Description: * This subroutine prints out the latest log file. * * Subroutine and function calling outline: * SPNMC1 ! Source in RICHLIB.ULB module SPNMC1 * * Constants: * type name usage * ---- ---- ----- CHARACTER*7 CMMAND ! Print command INTEGER*2 LENGTH ! Length of print command * DATA CMMAND /'PRI C.C'/ PARAMETER (LENGTH = 7) * * * ---Executable statements begin here--- * CALL SPNMC1(CMMAND,LENGTH) RETURN END