Path: utzoo!attcan!uunet!samsung!aplcen!jhunix!jj From: jj@jhunix.HCF.JHU.EDU (Jim Jones) Newsgroups: comp.lang.rexx Subject: Re: Programming style Message-ID: <3327@jhunix.HCF.JHU.EDU> Date: 17 Nov 89 16:29:37 GMT References: <89320.222332JXS118@PSUVM.BITNET> Reply-To: jj@jhunix.UUCP (Jim Jones) Organization: The Johns Hopkins University - HCF Lines: 74 In article <89320.222332JXS118@PSUVM.BITNET> JXS118@PSUVM.BITNET (Jeff Siegel, St Operator@Atherton Hall) writes: >I wasted a significant amount of time today trying to figure out why a user's >virtual machine was acting completey wacko. Turns out that they had >accidently created a file named Q EXEC. So whenever any rexx program did >a query, as in: > >'Q Disk' > >it wound up executing Q EXEC instead, which created a lot of confusion. You raise a good point here, but your example isn't entirely accurate... Non-VM/CMS people might want to stop reading this. As far as I know, this info is VM-specific. The best way to avoid the kinds of problems that you're describing (which most definitely should be avoided), is to include the line: address command; at the very start of all your Rexx programs. You'll have to do a little extra work as the programmer, but so what? Your code will be easier to understand and will run faster as well. The "extra work" consists of: - adding a CP prefix to CP commands you want to execute - adding an EXEC prefix to any EXEC's you want to run (unless you use the "call" statement, or invoke them as Rexx functions) - converting commands and their parameters/options to upper case before executing them For example, to issue the command you mentioned, you would have to code "QUERY DISK" or "Q DISK" but *not* "Q Disk" or "Query disk" etc... A CP commands example, "CP Q SET" not "Q Set" An EXEC example, "EXEC MAIL" not "Mail" If you don't convert the commands to upper case, they won't be recognized by CMS. If you don't upcase (to invent a verb...) the command parameters and options they either won't be recognized or will do odd things, so be careful. CMS really will do exactly what you tell it, even if you didn't want it to do so. So that "LISTFILE * exec" will search for all files with a filetype of "exec" and (most likely) not find any. If you didn't code the "address command" line in your EXEC it would work exactly as you expect and search for files with a filetype of "EXEC" (having converted the parameter to upper case for you). >I think it would help everyone in the VM/CMS / Rexx community if people >wrote 'CP QUERY ...' (which is what they really mean) than some abbreviation >that can be misconstrued by the system. It certainly would have saved me the >time today. Without "addrress command" you're still not safe. What if the user had a "CP EXEC" on their 191 disk? The 'CP QUERY ...' would still not do what you wanted. And just for completeness sake, "Q DISK" is a CMS command, not a CP command. Of course nothing is perfect, people can always create EXEC's and MODULES on their private disks which are named the same thing as something on the system. But using "address command" should cut down on those types of conflicts. And as I said, you'll get a significant performance boost because all the "extra work" you've done means that the system doesn't have to do it for you. >+-----------------------------------------------------------------------+ >| Jeff Siegel | JXS118 at PSUVM | >| 24 Atherton Hall | | >| 862-5124 | "No news is netsnooze........ | >+-------------------------------+---------------------------------------+ -jj BTW -- The "address command" hint applies to Rexx EXEC files. You probably don't want to start an XEDIT macro that way!