20-May-1983 17:05:12 VAX-11 FORTRAN V3.0-2 Page 1 20-May-1983 17:05:11 DRB1:[SCI.JILL]JJCMD.FOR;2 0001 FUNCTION JJCMD( CMD ) 0002 c. Returns the input command to the user 0003 c. 0004 c.OUT: JJCMD <=I= the number of characters in the input. (-1:EOF) 0005 c. 0006 c.i/o CMD <=C= User Input 0007 c. (1) From DCL Command line, If None and CMD.gt.' ' 0008 c. (2) From User Input (UNIT=5). If Input = @FILE, then 0009 c. (3) From FILE 0010 c. 0011 c.Goodies: $DCL_line ... Insues the command via LIB$CMD 0012 c. @File .. Reads the file (from unit 99, 98...) 0013 c. CMD = '~ONE~' .. Accept one line from CMD and exit 0014 c. 0015 c. COMMON/JJ_CMD/ JJ_TY !!= 1:CMD, 2:User, 3:File 0016 c. Set <0 after call for no User input 0017 c. 0018 c.Uses: LIB$GET_FOREIGN, JJDCL, JJLEN 0019 c. 0020 c.Rev: 11/07/82 Use JJUNAM to process @.nnn 0021 c.Rev: 06/15/80 Use Unit=5 For input 0022 c------------------------------------------------------------end.of.info 0023 common /JJ_CMD/ JJ_TY 0024 character CMD*(*), prstr*(132) 0025 data iunit/100/, is1cmd/0/ 0026 41 format(132a) 0027 49 format(q,132a) 0028 c. 0029 if( CMD.eq.'~ONE~' ) then 0030 is1cmd = 1 0031 goto 9000 0032 endif 0033 JJCMD = 0 0034 prstr = CMD 0035 c. 0036 c... Get the next input 0037 c. 0038 1000 continue 0039 c. 0040 c... Foreign input 0041 c. 0042 if( is1cmd.eq.1 .and. JJ_TY.eq.1 ) goto 8000 0043 if( JJ_TY.eq.0 ) then !!First try 0044 JJ_TY = 2 0045 call lib$get_foreign( CMD,,JJCMD ) 0046 if( JJCMD.eq.0 ) goto 1000 0047 JJ_TY = 1 0048 c. 0049 c... User input 0050 c. 0051 else if( JJ_TY.le.2 ) then 0052 if( prstr.le.' ' ) goto 8000 !!>> No user prompt 0053 type 41,prstr(1:jjlen(prstr)),' ' 0054 read(5,49,end=8000) JJCMD, CMD 0055 c. 0056 c... File input 0057 c. JJCMD 20-May-1983 17:05:12 VAX-11 FORTRAN V3.0-2 Page 2 20-May-1983 17:05:11 DRB1:[SCI.JILL]JJCMD.FOR;2 0058 else if( JJ_TY.eq.3 ) then 0059 read( iunit, 49, end=1900 ) JJCMD, CMD 0060 else 0061 goto 8000 0062 endif 0063 goto 2000 0064 c. .... 0065 c. 0066 c... E.O.F. on file input 0067 c. 0068 1900 continue 0069 close( unit=iunit ) 0070 iunit = iunit+1 0071 if( iunit.ge.100 ) JJ_TY = jjsave 0072 goto 1000 !!>> retry next level 0073 c. 0074 c... $ and @ command processing 0075 c. 0076 2000 continue 0077 if( CMD(1:1).eq.'$' ) then 0078 c. 0079 c... $DCL_command ... Issue a DCL command 0080 c. 0081 call jjdcl( CMD(2:) ) 0082 goto 1000 0083 c. .... 0084 else if( CMD(1:1).eq.'@' ) then 0085 c. 0086 c... @file_name ... Open an indirect file 0087 c. 0088 if( iunit.eq.100 ) jjsave = JJ_TY 0089 iunit = iunit-1 0090 if( cmd(2:2).eq.'.' ) call JJUNAM(cmd(2:)) 0091 open(unit=iunit,type='old',readonly,name=CMD(2:),err=2900) 0092 JJ_TY = 3 0093 goto 1000 !!>> Start on next LOWer level 0094 endif 0095 goto 9000 !!>> return 0096 c. ---- 0097 c... Illegal file name 0098 c. 0099 2900 continue 0100 type *,'Can''t open ',CMD(1:jjlen(CMD)) 0101 iunit = iunit+1 0102 if( iunit.ge.100 ) JJ_TY = 2 0103 goto 1000 !!>> retry next level 0104 c. 0105 c. 0106 c... Return an E.O.F. 0107 c. 0108 8000 continue 0109 JJCMD = -1 0110 CMD = '^Z' 0111 c. 0112 9000 continue 0113 return 0114 end JJCMD 20-May-1983 17:05:12 VAX-11 FORTRAN V3.0-2 Page 3 20-May-1983 17:05:11 DRB1:[SCI.JILL]JJCMD.FOR;2 PROGRAM SECTIONS Name Bytes Attributes 0 $CODE 864 PIC CON REL LCL SHR EXE RD NOWRT LONG 1 $PDATA 30 PIC CON REL LCL SHR NOEXE RD NOWRT LONG 2 $LOCAL 280 PIC CON REL LCL NOSHR NOEXE RD WRT LONG 3 JJ_CMD 4 PIC OVR REL GBL SHR NOEXE RD WRT LONG Total Space Allocated 1178 ENTRY POINTS Address Type Name 0-00000000 I*4 JJCMD VARIABLES Address Type Name Address Type Name Address Type Name Address Type Name AP-00000004@ CHAR CMD 2-0000008C I*4 IS1CMD 2-00000088 I*4 IUNIT 2-00000090 I*4 JJSAVE 3-00000000 I*4 JJ_TY 2-00000000 CHAR PRSTR LABELS Address Label Address Label Address Label Address Label Address Label Address Label 1-0000000C 41' 1-00000011 49' 0-00000039 1000 0-00000169 1900 0-00000187 2000 0-000002D3 2900 0-0000034B 8000 0-0000035B 9000 FUNCTIONS AND SUBROUTINES REFERENCED Type Name Type Name Type Name FOR$CLOSE FOR$OPEN JJDCL I*4 JJLEN JJUNAM LIB$GET_FOREIGN 20-May-1983 17:05:12 VAX-11 FORTRAN V3.0-2 Page 4 20-May-1983 17:05:11 DRB1:[SCI.JILL]JJCMD.FOR;2 0001 PROGRAM ZTEST 0002 c. 0003 c.test progrram for JJCMD 0004 c. 0005 common /JJ_CMD/ JJ_TY, iunit 0006 character*40 CMD 0007 call jjcmd('~ONE~') 0008 c. 0009 1000 continue 0010 CMD = '$JJCMD:' 0011 iret = JJCMD(CMD) 0012 type*,iret,' =JJCMD',JJ_TY,' =JJ_TY',iunit,' =Unit --',CMD 0013 if( iret.ge.0 ) goto 1000 0014 c. 0015 end PROGRAM SECTIONS Name Bytes Attributes 0 $CODE 139 PIC CON REL LCL SHR EXE RD NOWRT LONG 1 $PDATA 36 PIC CON REL LCL SHR NOEXE RD NOWRT LONG 2 $LOCAL 100 PIC CON REL LCL NOSHR NOEXE RD WRT LONG 3 JJ_CMD 8 PIC OVR REL GBL SHR NOEXE RD WRT LONG Total Space Allocated 283 ENTRY POINTS Address Type Name 0-00000000 ZTEST VARIABLES Address Type Name Address Type Name Address Type Name Address Type Name 2-00000000 CHAR CMD 2-00000028 I*4 IRET 3-00000004 I*4 IUNIT 3-00000000 I*4 JJ_TY LABELS Address Label 0-00000011 1000 ZTEST 20-May-1983 17:05:12 VAX-11 FORTRAN V3.0-2 Page 5 20-May-1983 17:05:11 DRB1:[SCI.JILL]JJCMD.FOR;2 FUNCTIONS AND SUBROUTINES REFERENCED Type Name I*4 JJCMD COMMAND QUALIFIERS FORTRAN /NOF77/NOLIST/LIST/DEBUG/CHECK=ALL/NOOPT/CONTINUATION=30 JJCMD /CHECK=(BOUNDS,OVERFLOW,UNDERFLOW) /DEBUG=(SYMBOLS,TRACEBACK) /STANDARD=(NOSYNTAX,NOSOURCE_FORM) /SHOW=(NOPREPROCESSOR,NOINCLUDE,MAP) /NOF77 /NOG_FLOATING /I4 /NOOPTIMIZE /WARNINGS /NOD_LINES /NOCROSS_REFERENCE /NOMACHINE_CODE /CONTINUATIONS=30 COMPILATION STATISTICS Run Time: 2.71 seconds Elapsed Time: 3.12 seconds Page Faults: 500 Dynamic Memory: 135 pages