On 07.01.2022 03:00, Bob Bridges wrote: > I usually include JCL under the ~very~ general rubric of "programming > language", but even mentally I think that's a stretch. It's more like a > macro language, sort of like .bat I guess. > > I may as well take this opportunity to include a mild rant. I've often heard > the programs you can write for automating some applications referred to as > "macros"; I have in mind VBA, for example, and what WordPerfect used to have > if WordPerfect is still around. It always seemed to me that VBA qualifies > just fine as a programming language, and what I write in VBA is not a > "macro", just a program. > > But then what is a macro? In searching for some sort of distinction that > would justify there being two different words, I've concluded to my own > satisfaction that a macro is a set of instructions that have no > decision-making capability, maybe no if-then syntax and definitely no > looping, probably no arithmetic, possibly some rudimentary logic operators > like NOT (and may only NOT). The old .bat language would fit this > description; so would JCL, especially before they added IF statements. So, > if I remember right, are the instruction sets I used to write for QMF. But > not VBA; not even TECO. (Anyone remember TECO?) > > Now I sit back and wait for someone more knowledgeable to correct me either > on the capabilities of the languages I named, or on the definition of "macro".
Most of the time Wikipedia is a quite good starting point, e.g. <https://en.wikipedia.org/wiki/Macro_(computer_science)>. The distinction between a macro/script (a set of statements allowing for executing repetitively in the context of a hosting application) and a stand-alone program can be even totally blurred, e.g. the following ooRexx program can be run from the macro menu of OpenOffice (OOO)/LibreOffice (LO) or as a stand-alone program from the command line: #!/usr/bin/env rexx use arg slotArg /* if called as a macro, we can access the document for which we were called */ scriptContext=uno.getScriptContext(slotArg) /* get the xScriptContext object */ if scriptContext<>.nil then /* o.k., we are invoked as a macro from OOo/LO */ do xContext=scriptContext~getComponentContext /* get the context (a XComponentContext) object */ xDesktop=scriptContext~getDesktop /* get the desktop (a XDesktop) object */ oDoc=scriptContext~getInvocationContext /* get the document for which this macro got invoked */ end else /* this program was called from outside of OOo, e.g. from the commandline */ do xContext = UNO.connect() /* get a connection to the OOo/LO server */ xDesktop = UNO.createDesktop(xContext) /* create the XDesktop from xContext */ /* create a word processor document: */ oDoc=xDesktop~XComponentLoader~loadComponentFromURL("private:factory/swriter", "_blank", 0, .UNO~noProps) end str="Hello IBM-Main ["date() time()"], this is ooRexx (cf. <https://www.RexxLA.org>) speaking ! " oDoc~XTextDocument~getText~getEnd~setString(str) ::requires UNO.CLS /* load UNO support (OpenOffice/LibreOffice) for ooRexx */ This ooRexx macro/script/program runs unchanged on Windows, MacOS and Linux and will add a string at the end of an OOO/LO word document that greets the members of this list and supplies the date and time of its invocation. A few remarks: * ooRexx allows for the "USE ARG" keyword in addition to "PARSE ARG": "USE ARG" fetches arguments by reference and can be used to fetch stems by reference * The tilde (~) is the ooRexx message operator; one can send messages to any value/object/instance in an ooRexx program. Left of the tilde is the receiving value/object/instance/receiver (these are synonyms), right of it the name of a method routine that conceptually the receiver is supposed to look up and invoke on behalf of the programmer. If the invoked method routine returns a result one can immediately send it a message too, if needed. * At the end of the program you see an ooRexx directive led in by the double-colons, in this case the "requires" directive. The ooRexx interpreter will first syntax check the entire REXX program and if no syntax errors were found it will proceed carrying out all directives, in this case it will call the ooRexx program named UNO.CLS which is a package of useful public routines and public ooRexx classes to ease interfacing with OpenOffice/LibreOffice. After all directives got carried out by the interpreter the execution of the program starts having all resources available at that point in time that got brought in by the directives. o "UNO" is the acronym for "universal network objects" (cf. <https://wiki.openoffice.org/wiki/Uno>) the c++ class model OOo/LO got built upon, using as protocol "urp" (uno remote protocol) which is a client/server protocol. * The macro/script/program checks whether it got called as a macro and if so, gets the document for which the macro should get invoked; if not, then the program was started from outside of a running OOO/LO and therefore starts up OOO/LO and creates a new word document to work on. After having a reference to the OOO/LO word document it realizes the necessary UNO interface to allow setting (adding) a new string at the end of the word document. ---rony ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
