/* REPEAT.CMD REXX program to peatedly call another program that cannot handle the "*" wildcard. */ Parse Arg Commandline Say Commandline If Commandline="" then Do Say " " Say "You must supply a program commandline..." Say " " Exit end /* do */ /* Parse the commandline, assume for now that only one "*" will be processed. */ NWords=Words(Commandline) /* Find the word that has the wildcard */ Command="" Do i=1 to NWords If Pos("*",Word(Commandline,i))<>0 then Do WildcardIndex=i Leave end /* do */ end /* do */ /* Set up the commandline for the external command. We need the stuff before the wildcard and the stuff after it to prepend and append to the files that the wildcard search will produce. */ CommandPre="" CommandPost="" Do i=1 to NWords Select when iWildcardIndex then CommandPost=CommandPost Word(Commandline,i) otherwise Wildcard=Word(Commandline,i) /* This word is the wildcard */ end /* select */ end /* do */ /* Now find the files that match the wildcard and execute the external program. First load the REXXUTIL library. */ call rxfuncadd 'SysLoadFuncs','RexxUtil','SysLoadFuncs' call sysloadfuncs /* Now get the list of files matching the wildcard spec */ rc=SysFileTree(WildCard,"File.","FO") /* Loop over the list of files and run the external program */ If File.0=0 then Do Say " " Say "No files matching the wildcard were found." End Else Do Do i=1 to File.0 Command=CommandPre File.i CommandPost Command end /* do */ End Exit