/* REXX *** */ ADDRESS SYSCALL /* track down the SMP/E name for a HFS binary */ PARSE ARG fname If fname = '' then Do Say 'Smpname: HFS filename input required' Exit 4 End PARSE SOURCE . . . . . . Envir . If Envir \= 'SH' then , IF SYSCALLS('ON')>3 THEN DO SAY 'Unable to establish the SYSCALL environment' SAY 'Return code was 'RC RETURN END /* determine the real path */ 'realpath 'fname' path' If retval = -1 then Do Say 'Unable to resolve path 'fname Exit 8 End Say 'File: 'fname Say 'Pathname: 'path /* check for sticky bit on executable */ /* in case this is not the real module */ 'stat 'path' stat.' Call dotime stat.st_ctime Say 'Creation date: 'svalue Call dotime stat.st_mtime Say 'Modified date: 'svalue If stat.st_sticky then Do Say 'Sticky bit ON - executable not loaded from hfs' Exit 4 End /* only look if there is more than one link to this file */ links = stat.st_nlink If links < 2 then Do Say 'Only one link found to this file' Exit 4 End else , Say 'Links: 'links 'getmntent mnt. 'stat.st_dev point = mnt.mnte_path.1 Say 'Mount point: 'point inode = stat.st_ino Say 'Inode: 'inode Say 'Generating list of matching HFS filenames' /* find all files with matching inode in the same file system */ Call runcmd , "/bin/find "point" -inum "X2D(inode)" -xdev -name [A-Z]*" Exit 0 /* format posix time values */ dotime: procedure expose svalue tm_hour tm_min tm_mon tm_mday tm_year arg gt 'gmtime 'gt' gm.' day = right(gm.tm_mday,2,0) /* derive day */ min = right(gm.tm_min,2,0) /* derive min */ mo = right(gm.tm_mon,2,0) /* derive month */ hr = right(gm.tm_hour,2,0) /* derive hour */ svalue = gm.tm_year'/'mo'/'day' 'hr':'min return /* run a command and report the results */ runcmd: procedure parse arg shcmd Address TSO /********************************************************************/ /* Free STDOUT */ /********************************************************************/ msgs = msg('OFF') "FREE FI(STDOUT)" address syscall 'getpid' unique=retval /* get the USS process id */ /********************************************************************/ /* Create temporary STDOUT file "/tmp/BPXSH."pid */ /********************************************************************/ "ALLOCATE FILE(STDOUT) PATH('/tmp/BPXPGM."unique"') ", "PATHOPTS(OWRONLY,OCREAT,OEXCL,OTRUNC) PATHMODE(SIRWXU)", "PATHDISP(DELETE,DELETE)" IF RC \= 0 Then Do msgs = msg(msgs) /* Allocate must have failed */ Say ' RUNCMD REXX exec failed to allocate STDOUT.' Say ' RUNCMD REXX exec did not run shell command ' shcmd RETURN END msgs = msg(msgs) /********************************************************************/ /* Invoke shell by calling BPXBATCH */ /********************************************************************/ /* If we are on V2R10 or higher, use BPXBATSL */ opsys = MVSVAR(SYSOPSYS) Parse Var opsys versn vv'.'mm'.'. fmid If versn = 'OS/390' & , vv >= 2 & mm > 8 then , "BPXBATSL PGM "shcmd else , "BPXBATCH PGM "shcmd /* we will accept RC = 1 without complaint */ IF RC > 256 Then DO Say ' RUNCMD Exit Status = ' RC/256 Say ' ' If RC = 32512 then , Say 'Program not found or not executable' END else , IF RC > 1 & RC \= 256 Then DO Say ' RUNCMD RC = ' RC Say ' ' END IF (RC \= 254) & (RC \= 255) THEN DO /***************************************************************/ /* Display output from STDOUT */ /***************************************************************/ "ALLOCATE FILE(oshout1) DA(*) LRECL(255) RECFM(F) REU" "Ocopy indd(STDOUT) outdd(oshout1) TEXT PATHOPTS(OVERRIDE)" "FREE DDNAME(oshout1 stdout)" END return