Code Comments
Programming Forum and web based access to our favorite programming groups.On Fri, 20 Aug 2004 20:28:04 GMT, "Howard Brazee" <howard@brazee.net>
wrote:
>On 20-Aug-2004, Doug Scott <dwscott@ieee.org> wrote:
>
>
>Why wouldn't we want to use IF ... THEN statements in JCL? They're clear,
>easy, and useful.
>What does JCI stand for?
A lower case L in some fonts. When I told Agent to switch to Courier,
it showed up as an L.
> I infer by the "hideous construct" phrase that it has
>something to do with the old COND logic.
As a scripting language, JCL is horrid. Assuming you're running W2K or
later, you need look no further than the computer before you for
excellent scripting languages. It's amazing how many people think DOS
.bat file is the only MS script language, even 'professional'
administrators. The full spec is at the URL at the end of this
message. Before you read it, I'll give two very simple demos. Copy and
paste this into a text file named demo1.vbs
Set wbemObjectSet = _
GetObject("winmgmts:\\.").InstancesOf("Win32_Service")
For Each wbemObject In wbemObjectSet
If wbemObject.State = "Running" Then
WScript.Echo " Service: " & wbemObject.DisplayName
End If
Next
Now run it by typing "cscript demo1.vbs". The output will show all
services running on your PC. The list might convince you you're not
running a 'toy computer'.
Next you might wonder what other information about a service, in
addition to DisplayName, is available. Look in the documentation? No,
look in the class definition. This is called 'introspection'. It's
available for ALL objects in object-land. Copy and paste this into a
text file named demo2.vbs and run it with "cscript demo2.vbs".
Set objClass = GetObject("winmgmts:\\.\root\cimv2:Win32_Service")
For Each objClassProperty In objClass.Properties_
WScript.Echo objClassProperty.Name
Next
The output should look like this:
AcceptPause
AcceptStop
Caption
CheckPoint
CreationClassName
Description
DesktopInteract
DisplayName
ErrorControl
ExitCode
InstallDate
Name
PathName
ProcessId
ServiceSpecificExitCode
ServiceType
Started
StartMode
StartName
State
Status
SystemCreationClassName
SystemName
TagId
WaitHint
If you're on a MS network, replacing the dot with the name of another
machine will give the same information about that machine. You don't
have to log onto its command line. You can just as easily list methods
available against services. This is now software should work .. IMO.
VBScript offers variables, loops, case statement, if .. then .. else,
local functions, call, editing pictures, math functions, string
functions, access to the OS API and the world of OO. JCL doesn't offer
any of that .. except IF around whole steps in batch jobs.
http://www.microsoft.com/downloads/...&displaylang=en
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.