CFPRIME RDHEAD                                                          RDHEAD      1
C***********************************************************************RIGHTE      1
C*                                                                     *RIGHTE      2
C*               Output Analysis Program for ETMSP (OAP)               *RIGHTE      4
C*               =======================================               *RIGHTE      5
C*                                                                     *RIGHTE     11
C*        copyright @(1993) Electric Power Research Institute          *RIGHTE     12
C*                                                                     *RIGHTE     13
C* EPRI reserves all rights in the software and associated             *RIGHTE     14
C* documentation as delivered. The software and its associated         *RIGHTE     15
C* documention or any portion thereof may not be reproduced in any form*RIGHTE     16
C* whatsoever without the consent of EPRI, except as explicity provided*RIGHTE     17
C* for by license. Licensee shall submit a detailed description to EPRI*RIGHTE     18
C* of any changes or modifications to the software within two (2)      *RIGHTE     19
C* months after such changes or modifications are made. At EPRI's sole *RIGHTE     20
C* discretion, the software, as changed or modified, shall be given a  *RIGHTE     21
C* new designation sufficiently different from its then current        *RIGHTE     22
C* designation as to prevent mistake,confusion, or deception as between*RIGHTE     23
C* the current software as changed or modified.                        *RIGHTE     24
C*                                                                     *RIGHTE     25
C* A license under EPRI's rights in the software can be obtained       *RIGHTE     26
C* directly from EPRI.                                                 *RIGHTE     27
C*                                                                     *RIGHTE     28
C* This program and supporting materials may be independently available*RIGHTE     29
C* from Electric Power Software centre (EPSC) for an appropriate       *RIGHTE     30
C* distribution fee. The EPSC is a service of                          *RIGHTE     31
C*                                                                     *RIGHTE     32
C*                    Power Computing Company                          *RIGHTE     33
C*                    1930 Hi Line                                     *RIGHTE     34
C*                    Dallas, Tx 75207                                 *RIGHTE     35
C*                                                                     *RIGHTE     36
C* NEITHER EPRI, ANY MEMBER OF EPRI, NOR ANY PERSON OR  ORGANIZATION   *RIGHTE     37
C* ACTING ON BEHAVE OF THEM:                                           *RIGHTE     38
C*                                                                     *RIGHTE     39
C* 1. MAKE ANY WARRANTY OR REPRESENTATION WHATSOEVER, EXPRESS OR       *RIGHTE     40
C*    IMPLIED, INCLUDING ANY WARRANTY OF MERCHANTABILITY OR FITNESS OR *RIGHTE     41
C*    ANY PURPOSE WITH RESPECT TO THE SOFTWARE OR ITS ASSOCIATED       *RIGHTE     42
C*    DOCUMENTATION; OR                                                *RIGHTE     43
C*                                                                     *RIGHTE     44
C* 2. ASSUMES ANY LIABILITY WHATSOEVER WITH RESPECT TO ANY USE OF THE  *RIGHTE     45
C*    SOFTWARE OR ITS ASSOCIATED DOCUMENTATION OR ANY PORTION THEREOF  *RIGHTE     46
C*    OR WITH RESPECT TO ANY DAMAGES WHICH MAY RESULT FROM SUCH USE.   *RIGHTE     47
C*                                                                     *RIGHTE     48
C* THIS NOTICE MAY NOT BE REMOVED FROM THE SOFTWARE BY ANY USER        *RIGHTE     49
C* THEREOF.                                                            *RIGHTE     50
C*                                                                     *RIGHTE     51
C***********************************************************************RIGHTE     52
C                                                                       RDHEAD      3
      SUBROUTINE RDHEAD(IU8,IEND,NCONVO,IOFF)                           RDHEAD      4
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCRDHEAD      5
CD                                                                      RDHEAD      6
CD           THE ROUTINE READS THE  HEADER INFORMATION FROM THE         RDHEAD      7
CD           CHANNEL FILE SUCH AS THE POINTERS AND THE BUS NAMES,ETC.   RDHEAD      8
CD                                                                      RDHEAD      9
CD           CALLING PARAMETERS :                                       RDHEAD     10
CD                                                                      RDHEAD     11
CD                       IU8    - LOGICAL UNIT NUMBER FOR THE BINARY FILRDHEAD     12
CD                       IEND   - LOGICAL FLAG FOR END OF FILE          RDHEAD     13
CD                       NCONVO - NO. OF MONITORED CONVERTER BUS        RDHEAD     14
CD                       IOFF   - FIELD OFFSET FOR THE CONVERTER BUS    RDHEAD     15
CD                                IN THE ARRAY STORING THE BUS NAME     RDHEAD     16
C                                                                       RDHEAD     17
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCRDHEAD     18
      INCLUDE 'PARAM.INS'                                               RDHEAD     19
      INCLUDE 'DBFLG.INS'                                               RDHEAD     20
      DIMENSION IBUF(128)                                               RDHEAD     21
                                                                        RDHEAD     22
      COMMON /REC9/ IRECS,NREC,IREC9(128)                               RDHEAD     23
      COMMON /RECPT/ KRSTRT, ISTNAM, IIDARY, ITYARY, IHREC,ICHAN,       RDHEAD     24
     *          NPFL,LRREC,IRREC                                        RDHEAD     25
      LOGICAL IEND                                                      RDHEAD     26
      INCLUDE 'JJNAME.INS'                                              RDHEAD     27
                                                                        RDHEAD     28
C ...(used in RDHEAD and BUSNAM)                                        RDHEAD     29
C      INTEGER*4   LFNO(NBUF)                                           RDHEAD     30
C      CHARACTER*2 CCTID(NBUF)                                          RDHEAD     31
                                                                        RDHEAD     32
      INTEGER*4   LFNO(NBUF1)                                           RDHEAD     33
      CHARACTER*2 CCTID(NBUF1)                                          RDHEAD     34
      COMMON /LFNOID/ LFNO                                              RDHEAD     35
      COMMON /LFNOCD/ CCTID                                             RDHEAD     36
C ...                                                                   RDHEAD     37
                                                                        RDHEAD     38
      LDEBUG=DEBUG(1)                                                   RDHEAD     39
C                                                                       RDHEAD     40
C   READ IITY ARRAYS                                                    RDHEAD     41
C                                                                       RDHEAD     42
      KK=-128                                                           RDHEAD     43
      NREC=ITYARY                                                       RDHEAD     44
      DO 910 I=1,IRECS*3                                                RDHEAD     45
         CALL DAIWR4(IU8,1,NREC,IBUF,128,IEND)                          RDHEAD     46
         KK=KK+128                                                      RDHEAD     47
         DO 900 K=1,128                                                 RDHEAD     48
            IITY(KK+K)=IBUF(K)                                          RDHEAD     49
 900     CONTINUE                                                       RDHEAD     50
 910  CONTINUE                                                          RDHEAD     51
                                                                        RDHEAD     52
      IF(LDEBUG) WRITE(IDBOUT,'(A)')' (ITY(1,CHAN#) IS THE Y-TITLE PT'  RDHEAD     53
                                                                        RDHEAD     54
      DO 110 I=1,ICHAN                                                  RDHEAD     55
         CALL UNPACK(CCTID(I),ITY1,ITY(1,I))                            RDHEAD     56
         LFNO(I)=ITY(2,I)                                               RDHEAD     57
         IF(LDEBUG) THEN                                                RDHEAD     58
            WRITE(IDBOUT,1210) I,LFNO(I),CCTID(I),ITY1,ITY(2,I)         RDHEAD     59
 1210       FORMAT(1X,'+ (RDHEAD) LFNO(',I4,'=',I6,                     RDHEAD     60
     1      ' CCTID() = ',A2,'ITY(1,I) ',I6,'ITY(2,I) ',I4)             RDHEAD     61
         ENDIF                                                          RDHEAD     62
 110  CONTINUE                                                          RDHEAD     63
                                                                        RDHEAD     64
                                                                        RDHEAD     65
C                                                                       RDHEAD     66
C      IF(LDEBUG) THEN                                                  RDHEAD     67
C         WRITE(IDBOUT,'(A)')' (ITY(1,CHAN#) IS THE Y-TITLE PT'         RDHEAD     68
C         DO 100 I=1,ICHAN                                              RDHEAD     69
C            WRITE(IDBOUT,1200) I,ITY(1,I),I,ITY(2,I)                   RDHEAD     70
C 1200       FORMAT(1X,'++++ (RDHEAD) ITY(1,',I4,')=',I4,               RDHEAD     71
C     1      '    ITY(2,',I4,')=',I4)                                   RDHEAD     72
C 100     CONTINUE                                                      RDHEAD     73
C      ENDIF                                                            RDHEAD     74
                                                                        RDHEAD     75
C                                                                       RDHEAD     76
C    READ IID ARRAYS                                                    RDHEAD     77
C                                                                       RDHEAD     78
C      NREC=IIDARY                                                      RDHEAD     79
C      KK=-128                                                          RDHEAD     80
C      DO 930 I=1,IRECS                                                 RDHEAD     81
C         CALL DAIWR4(IU8,1,NREC,IBUF,128,IEND)                         RDHEAD     82
C         KK=KK+128                                                     RDHEAD     83
C         DO 920 K=1,128                                                RDHEAD     84
C            IID(KK+K)=IBUF(K)                                          RDHEAD     85
C 920     CONTINUE                                                      RDHEAD     86
C 930  CONTINUE                                                         RDHEAD     87
C                                                                       RDHEAD     88
C      DO 110 I=1,ICHAN                                                 RDHEAD     89
C         IID4=IID(I)                                                   RDHEAD     90
C         LFNO(I)=IID2(1)                                               RDHEAD     91
C         CCTID(I)=IIDC(2)                                              RDHEAD     92
C         IF(LDEBUG) THEN                                               RDHEAD     93
C            WRITE(IDBOUT,1210) I,LFNO(I),CCTID(I)                      RDHEAD     94
C 1210       FORMAT(1X,'++++ (RDHEAD) LFNO(',I4,'=',I6,                 RDHEAD     95
C     1      ' CCTID() = ',A)                                           RDHEAD     96
C         ENDIF                                                         RDHEAD     97
C 110  CONTINUE                                                         RDHEAD     98
C                                                                       RDHEAD     99
C      DO 122 I2=1,NBUF                                                 RDHEAD    100
C         DO 121 I1=1,8                                                 RDHEAD    101
C            JNAME(I1,I2)=' '                                           RDHEAD    102
C 121     CONTINUE                                                      RDHEAD    103
C 122  CONTINUE                                                         RDHEAD    104
C                                                                       RDHEAD    105
C                                                                       RDHEAD    106
C   READ JNAME ARRAYS                                                   RDHEAD    107
C                                                                       RDHEAD    108
      NREC=ISTNAM                                                       RDHEAD    109
      DO 960 L=1,6                                                      RDHEAD    110
         KK=-128                                                        RDHEAD    111
         DO 950 I=1,IRECS                                               RDHEAD    112
            CALL DAIWR4(IU8,1,NREC,IBUF,128,IEND)                       RDHEAD    113
            KK=KK+128                                                   RDHEAD    114
            DO 940 K=1,128                                              RDHEAD    115
              JNAME(L,KK+K)=IBUF(K)                                     RDHEAD    116
 940        CONTINUE                                                    RDHEAD    117
 950     CONTINUE                                                       RDHEAD    118
 960  CONTINUE                                                          RDHEAD    119
C                                                                       RDHEAD    120
C     READ THE LAST TWO WORDS OF CONVERTER BUS                          RDHEAD    121
C                                                                       RDHEAD    122
      NREC=NREC+IRREC                                                   RDHEAD    123
C                                                                       RDHEAD    124
      IF(NCONVO.NE.0)THEN                                               RDHEAD    125
         IRECJ=IHREC                                                    RDHEAD    126
         DO 1090 L=7,8                                                  RDHEAD    127
            KK=-128                                                     RDHEAD    128
            DO 1080 I=1,IRECJ                                           RDHEAD    129
               CALL DAIWR4(IU8,1,NREC,IBUF,128,IEND)                    RDHEAD    130
               KK=KK+128                                                RDHEAD    131
               DO 1070 K=1,128                                          RDHEAD    132
                  JNAME(L,KK+K)=IBUF(K)                                 RDHEAD    133
 1070          CONTINUE                                                 RDHEAD    134
 1080       CONTINUE                                                    RDHEAD    135
 1090    CONTINUE                                                       RDHEAD    136
      ENDIF                                                             RDHEAD    137
C                                                                       RDHEAD    138
C                                                                       RDHEAD    139
      IF(LDEBUG) THEN                                                   RDHEAD    140
         DO 970 I=1,ICHAN                                               RDHEAD    141
            WRITE(IDBOUT,1230) I,(JNAME(IX,I),IX=1,8)                   RDHEAD    142
 1230       FORMAT(1X,'++(RDHEAD)++ CHAN=',I4,1X,3(A4),1X,3(A4),        RDHEAD    143
     1      1X,2(A4))                                                   RDHEAD    144
  970    CONTINUE                                                       RDHEAD    145
      ENDIF                                                             RDHEAD    146
                                                                        RDHEAD    147
      RETURN                                                            RDHEAD    148
      END                                                               RDHEAD    149
                                                                        RDHEAD    150
