      SUBROUTINE XGPIMW (MSGNO,I,J,A)
C
C     XGPIMW IS USED TO WRITE ALL NON-DIAGNOSTIC MESSAGES
C     GENERATED BY THE XGPI MODULE.
C
      IMPLICIT INTEGER (A-Z)
      EXTERNAL        RSHIFT,ANDF
      DIMENSION       HDG1(18),HDG2(7),HDG3(2),HDG4(22),HDG5(26),
     1                LINE(12),A(6)
      CHARACTER       UFM*23,UWM*25,UIM*29
      COMMON /XMSSG / UFM,UWM,UIM
      COMMON /SYSTEM/ ZSYS(90),LPCH,LDICT
      COMMON /OUTPUT/ PGHDG(1)
      COMMON /XGPIC / ICOLD,ISLSH,IEQUL,NBLANK,NXEQUI,
     1                NDIAG,NSOL,NDMAP,NESTM1,NESTM2,NEXIT,
     2                NBEGIN,NEND,NJUMP,NCOND,NREPT,NTIME,NSAVE,NOUTPT,
     3                NCHKPT,NPURGE,NEQUIV,NCPW,NBPC,NWPC,
     4                MASKHI,MASKLO,ISGNON,NOSGN,IALLON,MASKS(1)
      COMMON /XGPI6 / MEDTP,FNMTP,CNMTP,MEDPNT,LMED,IPLUS,DIAG14,DIAG17
      COMMON /XGPID / ICST,IUNST,IMST,IHAPP,IDSAPP,IDMAPP,
     1                ISAVE,ITPFLG,IAPND,IDUM(5),IEQFLG
      COMMON /XGPI5 / IAPP,START,ALTER(2),SOL,SUBSET,IFLAG,IESTIM,
     1                ICFTOP,ICFPNT,LCTLFL,ICTLFL(1)
      COMMON /MODDMP/ IFLG(6),NAMOPT(26)
      COMMON /RESDIC/ IRDICT, IROPEN
      EQUIVALENCE     (ZSYS( 2),OP    ), (ZSYS( 3),NOGO  ),
     1                (ZSYS( 9),NLPP  ), (ZSYS(12),NLINES),
     2                (ZSYS(77),BKDATA), (ZSYS(26),CPPGCT),
     3                (ZSYS(19),IECHO ), (ZSYS(24),ICFIAT)
      DATA    HDG1  / 17, 4H    ,4H COS,4HMIC ,4H/ NA,4HSTRA,4HN DM,
     1                4HAP C,4HOMPI,4HLER ,4H- SO,4HURCE,4H LIS,
     2                4HTING,4*4H     /
      DATA    HDG2  / 6, 6*4H         /
      DATA    HDG3  / 1, 4H           /
      DATA    HDG4  / 21,
     1                4HINTE,4HRPRE,4HTED ,4HFROM,4H THE,4H OSC,4HAR. ,
     2                4HNEGA,4HTIVE,4H DMA,4HP IN,4HDICA,4HTES ,4HA NO,
     3                4HN EX,4HECUT,4HABLE,4H INS,4HTRUC,4HTION,4H    /
      DATA    HDG5  / 25,
     1                4H* * ,4H*  D,4H M A,4H P  ,4H C R,4H O S,4H S -,
     2                4H R E,4H F E,4H R E,4H N C,4H E  ,4H * *,4H *  ,
     3                7*4H    ,4HMODU,4HLE  ,4H  NA,4HMES  /
      DATA    KDLH   / 0     /
      DATA    ISTAR  / 1H*   /
      DATA    IPAGE  / 0     /
      DATA    IBLNK  / 4H    /
C
C
      DIAGI4 = DIAG14
      IF (DIAG14 .EQ. 10) DIAGI4 = 0
      IF (DIAGI4.NE.0 .OR. DIAG17.NE.0) GO TO 100
      IF (IECHO.EQ.-2 .AND. MSGNO.NE.9) RETURN
      GO TO 110
 100  IF (IECHO.EQ.-2 .AND. (MSGNO.LE.4 .OR. MSGNO.EQ.8) .AND.
     1    MSGNO.NE.9) RETURN
 110  IF (MSGNO.LE.0 .OR. MSGNO.GT.13) GO TO 2240
      GO TO (1860,1960,2000,2020,2040,2060,2080,2100,2160,2080,
     1       1985,1970,2400), MSGNO
C
C     MESSAGE 1 - INITIALIZE PAGE HEADING
C     ===================================
C
 1860 I1 = -I
      IF (I1 .GE. 0) GO TO 1940
      I1 = HDG1(1)
      I2 = I1 + 1
      DO 1870 M = 1,I1
 1870 PGHDG(M+96) = HDG1(M+1)
      DO 1880 M = I2,32
 1880 PGHDG(M+96) = NBLANK
      IF (I .EQ. 1) GO TO 1888
      IF (I .EQ. 2) GO TO 1884
      I1 = HDG5(1)
      DO 1883 M = 1,I1
 1883 PGHDG(M+128) = HDG5(M+1)
      GO TO 1886
 1884 I1 = HDG4(1)
      DO 1885 M = 1,I1
 1885 PGHDG(M+128) = HDG4(M+1)
 1886 I1 = I1 + 32
      GO TO 1940
 1888 I1 = HDG2(1)
      I2 = I1 + 1
      DO 1890 M = 1,I1
 1890 PGHDG(M+128) = HDG2(M+1)
      DO 1900 M = I2,32
 1900 PGHDG(M+128) = NBLANK
      I1 = HDG3(1)
      I2 = I1 + 1
      DO 1920 M = 1,I1
 1920 PGHDG(M+160) = HDG3(M+1)
      DO 1930 M = I2,32
 1930 PGHDG(M+160) = NBLANK
      IF (DIAGI4.EQ.0 .AND. START.EQ.ICST) GO TO 3000
      IPAGE = 1
      CALL PAGE
      GO TO 3000
C
C     BLANK OUT HEADING
C
 1940 I2 = I1 + 1
      DO 1950 M = I2,96
      PGHDG(M+ 96) = NBLANK
 1950 CONTINUE
      NLINES = NLPP
      GO TO 3000
C
C     MESSAGE 2  (XGPI)
C     =================
C
 1960 IF (START .EQ. IUNST) GO TO 1980
      CALL PAGE2 (-6)
      WRITE  (OP,1965)
 1965 FORMAT (1H0,/,'0  + INDICATES DMAP INSTRUCTIONS THAT ARE PROCESS',
     1        'ED ONLY AT DMAP COMPILATION TIME.')
      WRITE  (OP,1967)
 1967 FORMAT ('0  * INDICATES DMAP INSTRUCTIONS THAT ARE FLAGGED FOR ',
     1        'EXECUTION IN THIS MODIFIED RESTART.')
      GO TO 3000
C
C     MESSAGE 12
C     ==========
C
 1970 CALL PAGE2 (-5)
      WRITE  (OP,1975) UIM
 1975 FORMAT (A29,' 4147', /5X,'NOTE THAT ADDITIONAL DMAP INSTRUCTIONS',
     1        ' (NOT INDICATED BY AN * IN THE DMAP SOURCE LISTING)',/5X,
     2        'NEED TO BE FLAGGED FOR EXECUTION IN ORDER TO GENERATE ',
     3        'CERTAIN REQUIRED DATA BLOCKS.', /5X,
     4        'SUCH INSTRUCTIONS AND THE ASSOCIATED DATA BLOCKS ARE ',
     5        'IDENTIFIED BELOW.')
      GO TO 3000
C
 1980 CALL PAGE2 (-6)
      WRITE  (OP,1965)
      WRITE  (OP,1982)
 1982 FORMAT ('0  * INDICATES DMAP INSTRUCTIONS THAT ARE FLAGGED FOR ',
     1        'EXECUTION IN THIS UNMODIFIED RESTART.')
      GO TO 3000
C
C     MESSAGE 11
C     ==========
C
 1985 CALL PAGE2 (-6)
      WRITE  (OP,1988) UIM,I
 1988 FORMAT (A29,' 4148', /5X,'NOTE THAT ADDITIONAL DMAP INSTRUCTIONS',
     1        ' (NOT INDICATED BY AN * IN THE DMAP SOURCE LISTING)',/5X,
     2        'NEED TO BE FLAGGED FOR EXECUTION SINCE THIS UNMODIFIED ',
     3        'RESTART INVOLVES DMAP LOOPING AND', /5X,
     4        'THE REENTRY POINT IS WITHIN A DMAP LOOP.  SUCH INSTRUCT',
     5        'IONS ARE IDENTIFIED BELOW.', /5X,
     6        'THE EXECUTION WILL, HOWEVER, RESUME AT THE LAST REENTRY',
     7        ' POINT (DMAP INSTRUCTION NO.',I5,2H).,/)
      GO TO 3000
C
C     MESSAGE 3  (KYXFLD)
C     ===================
C
 2000 NLINES = NLINES + 2
      IF (NLINES .GE. NLPP) CALL PAGE1
      WRITE  (OP,2010) I,J
 2010 FORMAT ('0TO GENERATE DATA BLOCK ',2A4,' - TURN ON THE EXECUTE ',
     1        'FLAG FOR THE FOLLOWING DMAP INSTRUCTIONS',/)
      GO TO 3000
C
C     MESSAGE 4  (KYXFLD)
C     ===================
C
 2020 NLINES = NLINES + 1
      IF (NLINES .GE. NLPP) CALL PAGE1
      L = ANDF(A(6),MASKHI)
      WRITE  (OP,2030) L,A(4),A(5)
 2030 FORMAT (1X,I4,2X,2A4)
      GO TO 3000
C
C     MESSAGE 5 - WRITE DMAP INSTRUCTION, FIRST LINE   (XSCNDM)
C     =========================================================
C
 2040 IF (DIAGI4 .EQ. 0) GO TO 2050
      IF (KDLH   .EQ. 0) GO TO 2255
 2042 CALL PAGE2 (-2)
      WRITE  (OP,2045) J,(A(M),M=1,I)
 2045 FORMAT (/1X,I7,2X,20A4)
 2050 IF (DIAG17 .NE. 0) WRITE (LPCH,2055) (A(M),M=1,I)
 2055 FORMAT (20A4)
      GO TO 3000
C
C     MESSAGE 6 - WRITE DMAP INSTRUCTION, CONTINUATION LINE   (XSCNDM)
C     ================================================================
C
 2060 IF (DIAGI4 .EQ. 0) GO TO 2070
      NLINES = NLINES + 1
      IF (NLINES .GE. NLPP) CALL PAGE
      WRITE  (OP,2065) (A(M),M=1,I)
 2065 FORMAT (10X,20A4)
 2070 IF (DIAG17 .NE. 0) WRITE (LPCH,2075) (A(M),M=1,I)
 2075 FORMAT (20A4)
      GO TO 3000
C
C     MESSAGE 7   (XLNKHD)
C     MESSAGE 10  (XLNKHD AND XOSGEN)
C     ===============================
C
 2080 CONTINUE
      IF (DIAGI4 .EQ. 0) GO TO 3000
      IWRITE = ISTAR
      IF (MSGNO .EQ. 10) IWRITE = IPLUS
      WRITE  (OP,2090) IPLUS,IWRITE
 2090 FORMAT (A1,2X,A1)
      GO TO 3000
C
C     MESSAGE 8  (KYGPI)
C     ==================
C
 2100 CALL PAGE1
      NLINES = NLINES + 4
      WRITE  (OP,2110)
 2110 FORMAT ('0THE FOLLOWING FILES FROM THE OLD PROBLEM TAPE WERE ',
     1        'USED TO INITIATE RESTART', //4X,
     2        'FILE NAME  REEL NO.  FILE NO.',/)
      DO 2150 M = I,J,3
      IREEL = ANDF(RSHIFT(A(M+2),16),31)
      IFILE = ANDF(A(M+2),MASKHI)
      CALL PAGE2 (-1)
      IF (IFILE .EQ. 0) GO TO 2130
      WRITE  (OP,2120) A(M),A(M+1),IREEL,IFILE
 2120 FORMAT (5X,2A4,2X,I8,2X,I8)
      GO TO 2150
 2130 WRITE  (OP,2140) A(M),A(M+1)
 2140 FORMAT (5X,2A4,2X,8H(PURGED))
 2150 CONTINUE
      GO TO 3000
C
C     MESSAGE 9  (KYGPI)
C     ==================
C
 2160 IF (BKDATA .LT. 0) CALL PAGE2 (-2)
      IF (BKDATA .EQ.-2) GO TO 2171
      IF (IFLG(1).EQ. 1) GO TO 2165
      WRITE  (OP,2161)
 2161 FORMAT (1H0,10X,'**COMPILATION COMPLETE - JOB TERMINATING WITH ',
     1       'NOGO STATUS**')
      GO TO 2175
 2165 IF (BKDATA .GE. 0) GO TO 2175
      WRITE  (OP,2170)
 2170 FORMAT (1H0,10X,'**NO ERRORS FOUND - EXECUTE NASTRAN PROGRAM**')
      GO TO 2175
 2171 WRITE  (OP,2172)
 2172 FORMAT (1H0,9X,'**NO ERRORS FOUND - NASTRAN EXECUTION TERMINATED',
     1        ' BY USER REQUEST**')
      GO TO 3000
C
C     DUMP FIAT IF SENSE SWITCH 2 IS ON
C
 2175 CALL SSWTCH (2,L)
      IF (L .EQ. 0) GO TO 2210
      CALL PAGE1
      NLINES = NLINES + 4
      WRITE  (OP,2180) A(1),A(2),A(3)
 2180 FORMAT (1H ,/5X,22HFIAT AT END OF PREFACE,3I15, /,1H ,/5X,'EQUIV',
     2     '  APPEND    LTU  TAPE  UNIT  FILE NAME',31X,'---TRAILER---')
      L1 = A(3)*ICFIAT - 2
      DO 2200 L = 4,L1,ICFIAT
      IEQUIV = 0
      IAPPND = 0
      ITAPE  = 0
      IF (RSHIFT(ANDF(A(L),IEQFLG),1) .GT. 0) IEQUIV = 1
      IF (ANDF(A(L),IAPND ) .GT. 0) IAPPND = 1
      IF (ANDF(A(L),ITPFLG) .GT. 0) ITAPE  = 1
      LTU = ANDF(RSHIFT(A(L),16),16383)
      IUNIT = ANDF(A(L),16383)
      IA1 = A(L+1)
      IA2 = A(L+2)
      IF (IA1 .NE. 0) GO TO 2185
      IA1 = IBLNK
      IA2 = IBLNK
 2185 M1  = L + 3
      M2  = L + 5
      CALL PAGE2 (-1)
      WRITE (OP,2190) IEQUIV,IAPPND,LTU,ITAPE,IUNIT,IA1,IA2
      IF (ICFIAT .EQ.  8) WRITE (OP,2191) (A(M),M=M1,M2)
      IF (ICFIAT .EQ. 11) WRITE (OP,2192) (A(M),M=M1,M2),(A(M+M2),M=3,5)
 2190 FORMAT (7X,I1,7X,I1,3X,I6,4X,I1,1X,I6,2X,2A4)
 2191 FORMAT (1H+,48X,3I20)
 2192 FORMAT (1H+,48X,6I10)
 2200 CONTINUE
 2210 IF (J .EQ. 0) GO TO 3000
      IF (IROPEN .EQ. 1) GO TO 2215
CWKBD OPEN (UNIT=4, FILE='FORTDIC.ZAP', STATUS='UNKNOWN')
      IROPEN = 1
 2215 WRITE  (IRDICT,2220) I
 2220 FORMAT (9X,'1,   XVPS    ,   FLAGS = 0,   REEL =  1,   FILE =',I7)
      CALL SSWTCH (9,DIAG09)
      IF (DIAG09 .EQ. 1) GO TO 3000
      CALL PAGE1
      NLINES = NLINES + 3
      WRITE  (OP,2230)
 2230 FORMAT (9X,'CONTINUATION OF CHECKPOINT DICTIONARY', /,1H )
      WRITE  (OP,2220) I
      GO TO 3000
 2240 NLINES = 2 + NLINES
      IF (NLINES .GE. NLPP) CALL PAGE1
      WRITE  (OP,2250) MSGNO
 2250 FORMAT (//,' NO MESSAGE AVAILABLE FOR MESSAGE NO. ',I4)
      GO TO 3000
C
C     PROCESS DMAP COMPILER OPTIONS SUMMARY
C
 2255 IF (KDLH .NE. 0) GO TO 3000
      IF (IPAGE.EQ. 0) CALL PAGE
      NLINES   = NLINES + 4
      LINE( 1) = NAMOPT( 1)
      LINE( 2) = NAMOPT( 2)
      LINE( 3) = NAMOPT( 5)
      LINE( 4) = IFLG  ( 2)
      LINE( 5) = NAMOPT( 9)
      LINE( 6) = NAMOPT(10)
      LINE( 7) = NAMOPT(13)
      LINE( 8) = NAMOPT(14)
      LINE( 9) = NAMOPT(17)
      LINE(10) = NAMOPT(18)
      LINE(11) = NAMOPT(21)
      LINE(12) = NAMOPT(22)
      IF (IFLG(1) .LE. 0) LINE(1) = NAMOPT(3)
      IF (IFLG(3) .LE. 0) GO TO 2300
      LINE( 5) = NAMOPT( 7)
      LINE( 6) = NAMOPT( 8)
 2300 IF (IFLG(4) .LE. 0) GO TO 2310
      LINE( 7) = NAMOPT(11)
      LINE( 8) = NAMOPT(12)
 2310 IF (IFLG(5) .LE. 0) GO TO 2330
      LINE( 9) = NAMOPT(15)
      LINE(10) = NAMOPT(16)
 2330 IF (IFLG(6) .LE. 0) GO TO 2345
      LINE(11) = NAMOPT(19)
      LINE(12) = NAMOPT(20)
 2345 WRITE  (OP,2350) (LINE(KKDJ),KKDJ=1,12)
 2350 FORMAT ('0  OPTIONS IN EFFECT ',2A4,A3,1H=,I1,3X,8A4,/3X,17(1H-),
     1        /)
      KDLH = 1
      GO TO 2042
C
C     MESSAGE 13   (XGPI)
C     ===================
C
 2400 NSCR = 315
      L    = 20
      CALL OPEN (*3000,NSCR,A(L),0)
      CALL PAGE1
      CALL PAGE3 (4)
      WRITE  (OP,2410) UIM
 2410 FORMAT (A29,' - DUE TO ERROR(S), POSSIBLY ORIGINATED FROM USER''S'
     1,      ' ALTER PACKAGE, THE UNMODIFIED RIGID FORMAT LISTING', /5X,
     2       'IS PRINTED FOR CROSS REFERENCE',/)
      L = 0
 2420 CALL READ (*2440,*2440,NSCR,A(1),18,0,M)
      IF (A(1) .EQ. IBLNK) GO TO 2430
      CALL PAGE3 (2)
      L = L + 1
      WRITE (OP,2045) L,(A(M),M=1,18)
      GO TO 2420
 2430 NLINES = NLINES + 1
      IF (NLINES .GE. NLPP) CALL PAGE
      WRITE (OP,2065) (A(M),M=1,18)
      GO TO 2420
 2440 CALL CLOSE (NSCR,1)
C
 3000 RETURN
      END
