      SUBROUTINE GETMCR(LINE,IDS)                                       00081 
      IMPLICIT NONE                                                     00082 
      INCLUDE ' 32766 .FID/NOLIST'                                      00082 
      INCLUDE '($LIBDEF)/NOLIST'                                !850822 00086 
      INCLUDE '($SSDEF)/NOLIST'                         !860407         00087 
      INCLUDE '($JPIDEF)/NOLIST'                                !860407 00088 
      BYTE LINE(80)                                                     00089 
      INTEGER*2 IDS                                                     00090 
      BYTE PRCNAM(15),SPACE,CR                                          00094 
      CHARACTER LOG_NAM*63,ESCAPE,TMP*63, FLINE*80                      00095 
      INTEGER*2 MAP,NARGS,LENGTH,LEN_PRNAM,IJPI(8),LEN,I                00096 
      INTEGER*4 ISTAT,LJPI(4)                                           00097 
      INTEGER*4 LIB$GET_FOREIGN, SYS$GETJPIW                            00098 
      LOGICAL*2 BLANK                                                   00099 
      EQUIVALENCE(IJPI(1),LJPI(1))                                      00101 
      DATA SPACE,CR/1H ,"15/, ESCAPE/"33/                               00102 
      CALL ARGS(NARGS,MAP)      !GET ARGUMENTS IN CALL TO GETMCR        00104 
      LENGTH=-80                !ASSUME FAILURE                         00105 
      PRCNAM(1)=0               !PROCESS NAME NOT YET LOOKED UP         00106 
      ASSIGN 32757 TO I32758                                            00108 
      GO TO 32758                                                       00108 
32757 IF(LENGTH.GE.0)THEN                                               00110 
      ASSIGN 32755 TO I32756                                            00110 
      GO TO 32756                                                       00110 
32755 CONTINUE                                                          00110 
      ENDIF                                                             00110 
      IF(NARGS.GE.2.AND.((MAP.AND."2).NE.0))IDS=LENGTH                  00112 
D     TYPE *,' END OF GETMCR ',LINE,IDS                                 00114 
      RETURN                                                            00115 
32758 CONTINUE                                                          00116 
      ISTAT = LIB$GET_FOREIGN(FLINE,,LEN)                               00125 
      IF(ISTAT.EQ.LIB$_INPSTRTRU)THEN                                   00126 
      CALL MESAGE(0,0,4,                                                00127 
     1 'W-Command line truncated to 80 characters')             !850822 00128 
      ENDIF                                                             00129 
D     CALL RPSTAT('GETMCR--LIB$GET-FOREIGN ',ISTAT)                     00131 
D     TYPE *,' FLINE ',FLINE, LEN                                       00132 
      IF (ISTAT)CALL CHRTOBYT(FLINE,LEN,LINE,LENGTH)                    00137 
D     TYPE *,' AFTER CHTB ',LINE,LENGTH                                 00138 
      GO TO I32758                                                      00139 
32756 CONTINUE                                                          00140 
      IF(LENGTH.EQ.0)THEN                                               00148 
      LENGTH=3  !LINE WILL BE JUST "TSK<CR>"                            00152 
      ELSE                                                              00154 
      IF(LENGTH.GT.75)THEN                                              00159 
      LENGTH=75                                                         00160 
      CALL MESAGE(0,0,4,                                                00161 
     1 'W-Command line truncated to 80 characters')             !850822 00162 
      ENDIF                                                             00163 
      DO I=LENGTH,1,-1                                                  00164 
      LINE(I+4)=LINE(I)                                                 00164 
      ENDDO                                                             00164 
      LENGTH=LENGTH+4                                                   00165 
      ENDIF                                                             00166 
      LINE(LENGTH+1)=CR         !APPEND CARRIAGE RETURN                 00168 
      IF(PRCNAM(1).EQ.0)THEN                                            00170 
      ASSIGN 32753 TO I32754                                            00170 
      GO TO 32754                                                       00170 
32753 CONTINUE                                                          00170 
      ENDIF                                                             00170 
      DO I=1,3                                                          00171 
      LINE(I)=PRCNAM(I)                                                 00171 
      ENDDO                                                             00171 
      IF(LENGTH.GT.4)LINE(4)=SPACE      !ADD SPACE FOR NONZERO LINE     00172 
      GO TO I32756                                                      00173 
32754 CONTINUE                                                          00174 
      IJPI(1)=15        !PROCESS NAME   !BUFFER LENGTH                  00178 
      IJPI(2)=JPI$_PRCNAM               !ACTION CODE            !860407 00179 
      LJPI(2)=%LOC(PRCNAM)              !ADDR OUTPUT BUFFER             00180 
      LJPI(3)=%LOC(LEN_PRNAM)           !ADDR OF ACTUAL LENGTH          00181 
      LJPI(4)=0         !END OF LIST                                    00182 
      ISTAT=SYS$GETJPIW(%VAL(0),,,IJPI,,,)                      !850805 00184 
D     CALL RPSTAT('GETMCR--$GETJPI',ISTAT)                              00185 
      IF(ISTAT.NE.SS$_NORMAL)THEN                                       00187 
      DO I=1,3                                                          00191 
      PRCNAM(I)=1HX                                   !851014           00191 
      ENDDO                                                             00191 
      ELSE                                                              00193 
      DO I=1,15                                                         00200 
      IF (PRCNAM(I).EQ.(1H )) PRCNAM(I)=1H_                     !851014 00201 
      ENDDO                                                             00202 
      IF(PRCNAM(1).EQ.1H.)THEN                                          00207 
      DO I=1,3                                                          00208 
      PRCNAM(I)=PRCNAM(I+3)                                             00208 
      ENDDO                                                             00208 
      ENDIF                                                             00209 
      ENDIF                                                             00210 
      GO TO I32754                                                      00211 
      END                                                               00212 
