|

|

VM/COM, January - February 1986
1
-
OO OO OOO OOO // OOOOOOO OOOOOOO OOO OOO
OO OO OO OOO OO // OO OO OO OO OO OOO OO
OO OO OO O OO // OO OO OO OO O OO
oo oo oo oo // oo oo oo oo oo
oooo oo oo // oo oo oo oo oo oo
oo oo oo // ooooooo ooooooo oo oo
0 ------------------------------------------------------------
Jan/Feb 1986 edition Volume 3 Numbers 1 & 2
- CsNews Network Newsletter
-
-
Staff:
0 Michele Robinson CSMICH at MAINE Editor
Andrew T. Robinson ANDY at MAINE CsNews Director
David Eckhardt DAE at PSUVAX1 Assistant Editor
Prof. G. Markowsky MARKOV at MAINE Faculty Advisor
-
0 Ôçççççççççççççççççççççççççççççççççççççççççççççççççççççççä
³ Newsletter article contribution Userid: CSNEWS@MAINE ³
³ ³
³ Contributions from readers welcomed and encouraged! ³
¨ççççççççççççççççççççççççççççççççççççççççççççççççççççççç]
1
0 Vm-Com Issue 3.1
-
0 Table of Contents
+ _____ __ ________
- Introduction to Vm/Com 3.1 . . . . . . . . . . . . . . . 1
CSNEWS Notes . . . . . . . . . . . . . . . . . . . . . . 2
Letters to the Editor . . . . . . . . . . . . . . . . . . 4
Life in the Fast Lane . . . . . . . . . . . . . . . . . . 6
FORTH . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Rexx's Recursion: . . . . . . . . . . . . . . . . . . . . 13
Harried Thoughts . . . . . . . . . . . . . . . . . . . . 26
OpCodes . . . . . . . . . . . . . . . . . . . . . . . . . 27
-
-
-
-
-
-
-
-
-
-
-
-
-
- 2
1
0 Vm-Com Issue 3.1
0 Introduction to Vm/Com 3.1
+ Introduction to Vm/Com 3.1
-
Hello again! As I'm sure you can see I finally have
managed to get V3-1 out. Last semester's finals and the
holidays managed to slow both the Vm/Com writers and myself
down quite a bit, thus causing the incredible slowness I
have had getting this issue out to you. In attempt at making
up some lost time this issue will be a combined
January/February edition. There will be no V3-2. The next
issue that will come out will be V3-3. Sorry for the delay
and hopefully the issues will be on time from now on, (at
least until next time finals come up -- ugh I'm sure most of
you can appreciate that problem).
0 In this issue are more letters to the editor (keep
sending more!!), the begining of a column written by the
creator of BITLIST, an article on the language Forth, a LONG
article on REXX recursion, some thoughts on finals and other
interesting things (sorry Joe that I didn't get this out at
the end of last semester), and of course the usual
assortment of OpCodes.
0 Until next time keep reading and enjoying and sending in
letters. Bye till V3-3!
0 Michele Robinson,
Editor
-
-
-
-
-
-
-
-
- 1
1
0 Vm-Com Issue 3.1
0 CSNEWS Notes
+ CSNEWS Notes
0 Andrew T. Robinson, (ANDY@MAINE)
-
Hello one and all, BITNETters! Here we are, not only in
a new semester, but a whole new year. Who knows what
developments will arise during 1986? Not I.
0 As far as CSNEWS goes, there's not much to report. Of
course, with the beginning of each new spring semester,
CSNEWS usage soars as more and more new users start hitting
BITNET with a bang. If you know any people out there who
are starting to use BITNET, by all means steer them to
CSNEWS!
0 We have been working hard attempting to make CSNEWS
faster so that all this new use won't degrade its
performance too badly. Examples include the BITNODE and
SENDME commands, which now operate much faster than before
(they are our biggest-overhead commands). Other services
have been similarly enhanced to provide faster response
time.
0 One new development of interest to MAINE users is the CS
Department Bulletin Board. With this system, the faculty of
the Computer Science Department here at UMO can put
information on a public disk about courses, homework,
assignments, etc.. This service is located on the CSNEWS
291 disk. To access this disk, use the command:
0 SHARE CSNEWS 291
0 Some of the features of the actual CSDEPT Bulletin system
are going to be migrated to the CSBB Bulletin Board also.
Some of these include: The ability to REPLACE existing
files that you own (originally created), and more
descriptive filetypes (NOTICE, PROGRAM, PROBLEM, etc.,
instead of just CSNOTICE).
0 Speaking of enhancements to CSBB, users may now create
semi-private discussions on CSNEWS. These discussions can be
read by any user, but can only be appended to by certain
specific people. If you wish to start such a discussion, get
in contact with me (ANDY@MAINE), stating your intent, the
name of your discussion, and at least a preliminary list of
people you want to be able to append to the discussion.
0 I guess that's about all for this issue... Oh! One final
note -- our CSNEWS Resource Manager (Michele Robinson) and
COMDISK Manager (David Liscomb) have had their ids renamed
from NMCS114 to CSMICH, and NMCS025 to CSDAVE, respectively.
If you've been trying to get in contact with them on their
0 2
1
0 Vm-Com Issue 3.1
0 old ids, now you know why there is no answer.
0 I think that's it... Let me check... Yes, that's all
folks! See you in V3-3!
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
3
1
0 Vm-Com Issue 3.1
0 Letters to the Editor
+ Letters to the Editor
- +++++++ +++++++ +++++++ +++++++ +++++++ +++++++ ++++++ +++++
0 Date: Fri, 22 Nov 1985 16:20 O
From: Tamir Weiner
Subject: Letter to the Editor
0 After a space of months, I've finally managed to get in
touch with the net again, and also catch up with the VM/COM
issues.
0 I have found the articles in VM/COM interesting,
informative, and written on a level to stuff you'd find in a
"non-virtual" magazine.
0 I commend the efforts of the editors and staff of VM/COM.
You all are making interesting, and in my estimation,
educational use of BITNET.
0 I'm sure that there are many unexplored paths which
VM/COM can take up. As an inter-netter myself, I think that
perhaps more attention could be given to how other networks
are also accessible. Perhaps this is a bit premature, as
BITNET itself might be considered an underused resource.
0 In the interest of information, I've sent a list
(probably incomplete) of other networks to the editor as
well. The revelations seem to happen like this: first the
"user" discovers that he can communicate with the other
users on his campus through the computer.... "far out"....
Then the user finds out that his computer is connected to
other computers around campus, the nation, and the world
through BITNET.... "incredible"... But life is more than
just the universities. There are dozens of public and
private networks out there which have gateway facilities to
BITNET for E-mail.... "awesome". The way to a global
village is progressing, gang. Let us all make use of it!
0 -- Tamir --
0 ------------------------------------------------------------
The list of NETWORK information mentioned above will
begin appearing in the next issue.
0 Ed.
-
-
- 4
1
0 Vm-Com Issue 3.1
0 +++++++ +++++++ +++++++ +++++++ +++++++ +++++++ +++++++ +++++++
0 Date: Sat, 30 Nov 85 15:29:42 EST
From:
Subject: Vm/Com
0 Greetings! I have been meaning to write to you for some
time now about your VM/COM magazine. I think its great!
Everytime I get a new copy of it I manage to learn
something!
0 I just read the article on consulting, which I think the
computer community can NEVER get enough of! Being an
operator, I get some pretty bizarre questions, many of which
I cannot answer. (Sad but true, an operator does NOT know
everything!:-)) And I value the consultant highly. I know I
wouldn't have the patience to handle most questions that
they have to deal with. (not to mention the user)!
0 I think ALL the articles are well written, clear and
concise. We sometimes have to train others about the
systems, and how some of it works, and your articles are
good examples of how to keep things simple, but to the
point.
0 Well, just wanted to extend some good words to you folks
in Maine and PSUVAX1 and other BITNET places near and far!
Keep up the good work! And if I can get together an article
on something I find useful, I won't hesitate to send it
along!
0 Paula
-
-
-
-
-
-
-
- 5
1
0 Vm-Com Issue 3.1
0 Life in the Fast Lane
+ Life in the Fast Lane
0 Christopher M. Condon, (BITLIB@YALEVMX)
-
The kind and lovely Michele Robinson has graciously
given me this space to write a monthly column on life on
the BITNET. So who am I to have received such an honor?
Funny you should ask...
0 This is a story. To some of you it may seem like an ego
trip, and perhaps it is. Beyond that it is an example of
how a guy that goes to a tiny commuter college in
southwestern Connecticut can achieve the nirvana of having
a column in a very popular electronic magazine. So please,
bear with me.
0 First of all, let me dispel the myth that I am a student
at Yale University. Neither am I faculty. As I said before
I am a student at a commuter college small enough to buy
computer time from Yale. This works out very nicely for the
students at Sacred Heart University, since we get the
benefits of the YCC mainframes while paying one of the lower
tuitions in Connecticut. One of those benefits of the
mainframes happens to be (you guessed it!) BITNET.
0 So there I was in May of 1984 sitting at my terminal when
I happened across the helpfile for BITNET:
0 "Hmmm," I said, "I'll have to try that sometime..."
0 SOMETIME turned out to be six months later (December 4th,
1984 for those of you that like precision). There on the
electronic bulletin board was a Bitnauts List.
0 "Oh yeah! This must have to do with that BITNET thing. I
can talk to these people all over the world. Sounds like
fun!"
0 Very soon I was talking to Wendy Fraker at the University
of Toledo, who told me about some amazing thing called
CSNEWS@MAINE that would send you programs and other
interesting stuff.
0 I said, "Hey, wouldn't it be great if there were some way
more than two people could talk together on the network?"
0 Said she, "There is already something that does that.
It is CHAT@PSUVMS1"
-
- 6
1
0 Vm-Com Issue 3.1
0 Back in those days (a long time ago in network terms) I
felt a great sense of adventure. CHAT came and went but
there were always new servers to find and try out. It was
a shame nobody kept information on all of those servers
in one spot. I had a notebook jammed full of helpfiles on
CSNEWS, VMBBOARD, BITSERVE, CANSERVE, BILLY, KERMSRV...the
list just kept longer and longer and then shorter and
shorter as conference machines opened and closed. Nobody
seemed to keep track of this stuff. Things were getting
mighty confusing.
0 Why didn't somebody put together a public disk with
information on how to use all of these file servers, name
servers, and conference machines? It would certainly save
a lot of trouble for a lot of people. Why not..me?
0 Thus was born BITLIB, Yale Computer Center's BITnet
services LIBrary. With a large amount of help from the
people in User Services, most especially my supervisor, Gary
Moss, I became the father of a fairly complete and user-
friendly public disk. Through a series of nested HELP menus
it provided up to date information on what was available to
those that would use the network. The network was there,
after all, to USE.
0 Alas, there was a problem. BITLIB was supposed to be
kept up to date. I was spending large amounts of time on
the chat machines trying to find out what was new in the
network. Inefficient, at best. How could anybody tell
me what they knew if they didn't understand what I knew?
0 I put together a list of all the file servers, name
servers and so on and titled it BITLIST (Not very clever,
but catchy). At the top of the list was a note to send any
deletions or additions to me. Hence, the list would be
updated and so would BITLIB. The information would come to
me. Little did I realize what would happen. BITLIST became
a fairly popular newsletter. This didn't surprise me too
much (there was a NEED for this information) but there were
some unexpected benefits.
0 I became a CSNEWS contact. Months before I had tried to
find out how to become one with no real result and suddenly
the job was offered to me. I got the privilege of being
able to install the BITLIST on NETSERV file servers as
BITNET SERVERS. Best of all, I get lots of mail from people
that want to get on the mailing list and tell me I am doing
a good job.
-
-
0 7
1
0 Vm-Com Issue 3.1
0 It just happened. I wasn't looking for fan mail or ego-
salve or privileges. I was having fun. That isn't saying
that I don't appreciate mail. Rather, I enjoy it immensely.
From the beginning, all I was looking for was good resume
material. Now I am trying to find out how it would be
possible to make a career out of BITNET, BITLIB, and the
BITLIST. Pipe dreams? Perhaps. But they are NICE pipe
dreams, and maybe not all that far from reality if I give it
a try.
0 That is the story. I didn't come up with any revelations
or do any great programming feats. I saw a need and I
filled it. There are great opportunities out there for
those of you that take the time to see them. Why don't I see
that many electronic magazines? How can you use the BITNET
to your best advantage? What are the educational benefits?
I am a student at a university with a name nobody ever heard
of and most people seem to mistake for a seminary. Yet
now I have a column in an electronic magazine, a BITNET
services library to manage and a BITLIST to write. Many
of you have the benefit of an Ivy League education, or
a more time on your hands, or better writing skills. Take
advantage of the network. The possiblities are endless.
0 Until next month, in terra pax hominibus bonae volunatis!
************************************************************
0 If you are interested, the latest issue of the BITLIST
is available from and NETSERV file server (there is one
at BITNIC for the US and Canada) as BITNET SERVERS via the
GET command. If you want to be added to the maining list,
send a memo to BITLIB@YALEVMX with your userid@node. If your
userid is about to expire at the end of the semester please
wait until January. Thank you.
-
-
-
-
-
-
-
8
1
0 Vm-Com Issue 3.1
0 FORTH, The Language of Productivity Creativity and Much More
+ FORTH, The Language of Productivity Creativity and Much More
0 Tamir Weiner, (UMFORTH@WEIZMANN)
-
In line with maximizing the advantages of information
networking, another "special interest subscription list" has
been started. It's called FIGIL, and is dedicated to the
sharing of information and ideas in connection with a less
known computer language which is called FORTH. The name
derives from FOURTH GENERATION COMPUTER LANGUAGE, but at the
time of its development, the inventor was restricted by the
existing hardware he had available to 5 character naming
conventions! So the hardware created (unintentionally, no
doubt) the literal pun of "going forth" to bigger and better
things using FORTH.
0 The FORTH list, FIGIL, can be reached on the BITNET
system by contacting UMFORTH@WEIZMANN. The list is run on a
similar basis to the ARPANET interests lists. Anyone can
submit questions, comments, ideas, etc. The list is strictly
non-commercial. Copyrighted material and source listings,
cannot of course be redistributed on BITNET.
0 To become a "subscriber" drop a note to FIGIL's address.
If you've never really thought you'd see a programming
language that could be elegant, efficient, powerful, and
"fun", then perhaps you should read on...
- FORTH was originally invented as a language for
microcomputers. As a result, it is particularly adapted to
these machines: it is fast (ten or twenty times as fast as
interpreted BASIC), it requires little memory, and it is
interactive (like BASIC) which makes it easy to develop and
test programs using FORTH.
0 FORTH is available on most commonly used microcomputers
including the IBM PC, APPLE II and MacIntosh, Radio Shack I,
III, and IV, Atari, CP/M computers, VIC 20, and even the
Sinclair. Similar in some respects to logo, FORTH is an
ideal language for the beginning programmer.
0 And yet, FORTH's advantages are so evident that advanced
programmer will find the language ideal for the development
of professional applications in a wide variety of
situations. FORTH has been implemented on large systems as
well and has versions which handle multi-tasking, and multi-
user environments.
-
- 9
1
0 Vm-Com Issue 3.1
0 The advantages of FORTH:
+ The advantages of FORTH:
0 *Extensible - The FORTH computer language builds upon itself.
A FORTH program is a set of increasingly powerful
commands. Each command is built on those that have been
previously added to the language. The low run-time
overhead for each command encourages modularity.
Extensibility is part of FORTH's innate structure.
0 *Easily Debugged - FORTH is an interactive language where
changes can be entered and immediately tested minimizing
programming development time.
0 *Powerful - FORTH spans the power of most other computer
languages.
0 L
A *-------FORTH----------------------*
N
G *----Lisp------*
U *--------- C -----------*
A
G *---------Pascal-------*
E
S *-------Fortran----*
0 *---Assembler---*
0 Power of language constructs
+ Power of language constructs
0 *Transportable - Applications written in FORTH can be run
easily on many different computers. In addition, the
ready availability of cross-compilers means that anyone
can maintain their own FORTH implementations.
0 *Compact - FORTH code becomes more compact than even assembly
code!
0 = = =
= = = =
M = = =
E = = = + + + + + +
M = = = + + + +
O forth code + + + + +
R + + + + + = = = =
Y + + + + = = = =
= = =
= = = assembly code
S = =
I
Z
E
-
10
1
0 Vm-Com Issue 3.1
0 Program functionablity
+ Program functionablity
0 Who uses FORTH?
- Everyone! FORTH is used in video games, operating
systems, real-time control, word processing, spreadsheet
programs, business packages, data base management systems,
robotics, and engineering and scientific calculations.
0 Where can you get more information on FORTH? Almost
everywhere! The FORTH community is broad, varied and
worldwide!
0 *The FORTH Interest Group (FIG) is a non-profit worldwide
organization of over 3500 members and more than 30 chapters
devoted to the dissemination of FORTH related information.
Most FIG chapters meet monthly. Contact FIG for the
interest group or chapter nearest you.
0 *FORTH Dimensions - is the bimonthly publication (6 issues
yearly) of the FORTH Interest Group. A one year
subscription is included with FIG membership. FORTH
Dimensions keeps members informed of the latest FORTH news,
applications and recent developments of the language.
0 *FORTH Vendors - over 100 vendors support implementations of
FORTH on almost every computer, large to small.
Professionally written books range from tutorial to more
advanced topics.
0 *FORTH Development - The FORTH Modification Laboratory,
FORTH National Convention, and the FORTH Standards Team meet
periodically to monitor and guide the evolution of FORTH.
0 *FIGIL, The Forth Interest Group International List - is an
open forum for the exchange of ideas on FORTH issues and
applications. The list is open to the public, members and
non-members of FIG, and is a means of communication amongst
FORTH users world-wide. The list is reached through any of
a number of computer networks including:
0 ARPANET BITNET USENET CSNET JANET
VNET DECNET XEROX UUCP CCNET
MAILNET
0 To reach FIGIL, send E-mail to userID: UMFORTH
at node: WEIZMANN
on network: BITNET
-
-
11
1
0 Vm-Com Issue 3.1
0 The conventions may vary from network to network, but
typically the syntax will resemble something like:
0 MAIL UMFORTH@WEIZMANN.BITNET
0 (check with your host system for details on E-mail
conventions)
- JOIN THE FORTH INTEREST GROUP!
0 To join the growing family of FIG members you can contact
FIG for for information at P.O.B. 1105, San Carlos,
California, 94070 USA. (telephone in the USA
1-415-962-8653.
0 =========================================
"FORTH provides a natural means of
communication between man and the
smart machines he is surrounding
himself with... I cannot imagine a
better language for writing programs,
expressing algorithms, or understand-
ing computers."
0 - Charles H. Moore, inventor of FORTH
from the Forward of "Starting FORTH"
-
-
-
-
-
-
-
-
-
0 12
1
0 Vm-Com Issue 3.1
0 Rexx's Recursion:
+ Rexx's Recursion:
Which is Better: Immitation or the Real Thing?
0 Billy E. Taylor, Jr. (TAYLORB@UMDD)
- Rexx.
0 We all love Rexx. It looks sooo much prettier than
those nasty, old EXEC languages. And it's sooo much more
formatted. With this gorgeously structured language it's so
easy to do things, that you naturally try to do more. You
can capture all kinds of terminal output from all kinds of
queries and requests and have it reformatted, split,
rejoined, alphabetized and all kinds of things to make it
pleasing to the tender eye. But more structure means more
work by the machine and that means it runs slower. Deadly
slower. A Rexx program to do a task can easily run one
third slower than it's EXEC2 counterpart. Never mind the
ease of coding and maintaining the exec, the people who use
your execs by and large don't know and don't care about
that. All they want is speed. And plenty of it.
0 Take one particular task that you may want to use in
several execs for various reasons--sorting. Sorting and
alphabetizing are the same thing really, so to solve one
problem is to solve both. Suppose that the raw natural
response of the CP command "Query Names" offends your eyes
and you wish to make it much prettier. I'll use this as an
example to show how your sorting technique can be used to
speed the exec run-time appreciably. There are many people
who have thought up and implemented the idea to alphabetize
the Query Names function. I'll credit Carl Smotricz for the
first implementation of this idea at this node (it was done
in EXEC2 and used Xedit and required an Exec file and Xedit
file), and Mark Snellings for the first Rexx version, a big
improvement. Most other versions have been improvements of
these basic ideas. There may have been versions before
theirs, but these were the first of which I am aware. The
Query Names function here at the University of Maryland IBM
systems looks like the following (except that there are
generally many more users than below):
- KAUL - C37, LOGONC30 - C30, BRUCE - C00, LOGONC1D - C1D
TEST - D06, LOGONC2A - C2A, LOGOND03 - D03, OPER - A00
KOSTOPOU - C07, HARGAN - C2D, ARNOLDD - DSC, 207610 - 044
SUB0209 - C3C, SUB0415 - D1D, OSTROVE -LE07, C113S182 - C3B
SUB229 - D16, FAJMAN - D12, DM1032 - C2F, CCORTEZ - D0A
RENUKA - 049, SHAFER -LE01, CHUNGHUI - C2C, C113S038 - D08
IGOLD -LE02, BIOM037 - 04D, MCNARY -LE06, LEEYY - C0A
C113S236 - C01, EPPICH - D01, MENCHEY - C33, SNEERI -LE00
THAO - C23, MIRANDA - C16, C113S189 - C15, SIMKO - C08
TAYLORB - D02
0 13
1
0 Vm-Com Issue 3.1
-
I am going to concentrate here on only the Rexx version,
assuming that most of you are sufficiently convinced that
Rexx is the better choice for a vast majority of Exec needs.
0 Below (Example 1) is a simplified version of the
original Rexx code to sort the Query Names output. Note
that it (identical to it's EXEC2 predecessor) sorts the
names by writing each name to a file as it is split from a
line and then using CMS Sort on the file. While this does
use less CPU processor time, it takes more real time because
of its many disk file accesses. When the system here is
fairly busy, 75-100+ users, this exec has been measured to
take 45+ seconds to run. While some might say that that is
an excuse to use the old EXEC2 version of the exec, it would
be far better to keep with a Rexx version and to improve it
so that it simply takes less time.
- >-------------Õ Example 1: Using CMS Sort þ---------------<
0 /* Rexx program to alphabetize Query Names replys */
EXECSERV CLEARSCN
trace off
say '...........'
address COMMAND
push '/**/'
"EXECIO * CP (LIFO STRING QUERY NAMES"
call sortit
exit
0 sortit: procedure expose nodeid
/* Sorting and outputing of users */
numuser = 0
do forever
pull qnline
hyphenloc = pos(' -',qnline)
if hyphenloc ª= 0 then
qnline = translate(qnline,' ','-')
/* Get rid of the '-' */
qnline = translate(qnline,' ',',')
/* Get rid of the ',' */
if word(qnline,1) ª= '/**/' then
do
i = 1
do forever
user = word(qnline,i)
if user = '' then leave
if hyphenloc ª=0 then i = i + 1
i = i + 1
j = i - 1
tempword = left(word(qnline,j),3)
if tempword = 'DSC' then user = insert(user,'*')
0 14
1
0 Vm-Com Issue 3.1
0 numuser = numuser + 1
push user
"EXECSERV FSWRITE $$QN$$QN DATA D * 1(RECFM F LRECL 12"
end /* Forever */
end /* If */
else leave
end /* Forever */
push 1 10 /* These four */
"SET CMSTYPE HT" /* lines do */
"SORT $$QN$$QN DATA D QN$$QN$$ DATA D" /* all the */
"SET CMSTYPE RT" /* sorting. */
say 'Current users:'
say
queue '/**/'
"EXECSERV FSREAD QN$$QN$$ DATA D 1 * (FIFO"
do forever
pull temp
if temp = '/**/' then leave
queue temp
end
numout = 0
pline =
do numuser
pull user
user = left(user,10)
pline = insert(pline,user)
numout = numout + 1
if numout = 8 then
do
say pline
numout = 0
pline =
end
end /* Do */
if numout > 0 then say pline
say
say numuser 'users listed.'
"ERASE $$QN$$QN DATA D"
"ERASE QN$$QN$$ DATA D"
return
- >-----------------Õ End of Example 1 þ--------------------<
0 You should carefully look at the lines reproduced below
as well as any line that uses the "push" of "pull" built-in
Rexx functions. These functions and lines are bounded by
various I/O times, some from disk and some from the stack.
If these type of functions can be altered so that all the
work is done internal to the program, execution could be
greatly improved. This assumes, of course, that there is
enough storage to accomodate the extra use of memory space.
-
15
1
0 Vm-Com Issue 3.1
0 "EXECSERV FSWRITE $$QN$$QN DATA D * 1(RECFM F LRECL 12"
:
:
push 1 10 /* These four */
"SET CMSTYPE HT" /* lines do */
"SORT $$QN$$QN DATA D QN$$QN$$ DATA D" /* all the */
"SET CMSTYPE RT" /* sorting. */
:
:
"EXECSERV FSREAD QN$$QN$$ DATA D 1 * (FIFO"
"ERASE $$QN$$QN DATA D"
:
:
"ERASE QN$$QN$$ DATA D"
- Such a small amount of storage should not be a problem,
however, unless you try to use the exec from deep within a
nest of Filelists, Xedits, Rdrlists, Helps and generally
those subsystems that themselves use a good chunk of your
storage. Given that there are N people logged onto your
system, this exec can use less than 2N to 3N additional
storage locations between the storage of the names, and the
temporary variables and locations needed.
0 One exceptionally simple exec that falls into this broad
catagory of being an improvement on the original is one
which uses a very intuitive, if inefficient, Bubble Sort.
This can be implemented by replacing the "sortit" procedure
in the earlier version with the one presented below.
- >------------Õ Example 2: Using Bubble Sort þ-------------<
0 /* Rexx program to alphabetize Query Names replys */
:
:
sortit: procedure /* Sorting and outputing of users */
numuser = 0
do forever
pull qnline
hyphenloc = pos(' -',qnline)
if hyphenloc ª= 0 then
qnline = translate(qnline,' ','-')
/* Get rid of the '-' */
qnline = translate(qnline,' ',',')
/* Get rid of the ',' */
if word(qnline,1) ª= '/**/' then
do
i = 1
do forever
user = word(qnline,i)
if user = '' then leave
if hyphenloc ª=0 then i = i + 1
0 16
1
0 Vm-Com Issue 3.1
0 i = i + 1
j = i - 1
tempword = left(word(qnline,j),3)
if tempword = 'DSC' then user = insert(user,'*')
numuser = numuser + 1
userlist.numuser = user
end /* Forever */
end /* If */
else leave
end /* Forever */
0 /************** Begin the BubbleSort Phase *************/
0 do i = 1 to numuser
do j = i to numuser
if (userlist.j < userlist.i) then do
bswap = userlist.j; userlist.j = userlist.i;
userlist.i = bswap
end
end
end
0 /*************** End the BubbleSort Phase ***************/
0 say 'Current users:'
say
numout = 0
pline =
usenum = 1
do numuser
user = userlist.usenum
usenum = usenum + 1
user = left(user,10)
pline = insert(pline,user)
numout = numout + 1
if numout = 8 then
do
say pline
numout = 0
pline =
end
end /* Do */
if numout > 0 then say pline
say
say numuser 'users listed.'
return
0 >--------------------Õ End of Example 2 þ------------------<
-
-
0 17
1
0 Vm-Com Issue 3.1
0 Notice carefully in the above the change in the
"numuser" counter and the "userlist" array. Two small
nested "do's" achieve the sorting when all of the names are
read in and available at the same time. Notice also that
this method needs absolutly zero disk file accesses. That
is the reason for the substantial decrease in real time
delay.
0 While this real time decrease is nice, the Bubble Sort
is, as many of you know, one of the worst sorts in this (or
any) universe. It takes up far too much processor time to
be considered a worthwhile solution to this exercise.
0 A far faster sort is QuickSort. Now the first thought
that comes to mind with QuickSort is recursion. QuickSort
IS recursive. While this can be the case, it isn't
necessarily the only way to go. I'll present below two
different quicksorts, one which is recursive and another
which is not. I'll present a few statistics and percentages
and such and explain which version I think is better under
which circumstances.
0 It is not the purpose of this article to teach
QuickSort, but rather to demonstrate both a recursive and
nonrecursive version of Quicksort in Rexx which can be
adapted for many sorting uses. As such, I will assume
knowledge of the basic operation of a QuickSort algorithm
and concentrate on the presented implementation. The
"sortit" routine from the recursive QuickSort version
appears below.
- >--------Õ Example 3: The Recursive QuickSort þ-----------<
0 /* Rexx program to alphabetize Query Names replys */
:
:
sortit: procedure /* Sorting and outputing of users */
numuser = 0
do forever
pull qnline
hyphenloc = pos(' -',qnline)
if hyphenloc ª= 0 then
qnline = translate(qnline,' ','-')
/* Get rid of the '-' */
qnline = translate(qnline,' ',',')
/* Get rid of the ',' */
if word(qnline,1) ª= '/**/' then
do
i = 1
do forever
user = word(qnline,i)
if user = '' then leave
if hyphenloc ª=0 then i = i + 1
0 18
1
0 Vm-Com Issue 3.1
0 i = i + 1
j = i - 1
tempword = left(word(qnline,j),3)
if tempword = 'DSC' then user = insert(user,'*')
numuser = numuser + 1
userlist.numuser = user
end /* Forever */
end /* If */
else leave
end /* Forever */
0 call quicksort 1, numuser
- say 'Current users:'
say
numout = 0
pline =
usenum = 1
do numuser
user = userlist.usenum
usenum = usenum + 1
user = left(user,10)
pline = insert(pline,user)
numout = numout + 1
if numout = 8 then
do
say pline
numout = 0
pline =
end
end /* Do */
if numout > 0 then say pline
say
say numuser 'users listed.'
return
0 /************ Begin the QuickSorting Phase ****************/
0 quicksort: procedure expose userlist.
0 arg first, last
key = partition(first, last)
0 if (key - 1 > first) then do
call quicksort first, key - 1
end
if (key + 1 < last) then do
call quicksort key + 1, last
end
return
-
0 19
1
0 Vm-Com Issue 3.1
0 partition: procedure expose userlist.
arg first, last
flag = 1; key = first
do until (last <= first)
if (flag) then
if (userlist.last < userlist.key) then do
temp = userlist.last; userlist.last = userlist.key
userlist.key = temp; key = last; flag = ªflag
end
else
last = last - 1
else
if (userlist.first > userlist.key) then do
temp = userlist.first; userlist.first = userlist.key
userlist.key = temp; key = first; flag = ªflag
end
else
first = first + 1
end
return (key)
0 /************* End of the QuickSorting Phase *************/
0 >------------------Õ End of Example 3 þ--------------------<
- The "partition" function does just what you would expect
it to do. It does choose the first element of the subarray
to be sorted to be the key element on which to partition the
remainder of the subarray. The only difference between this
and the 'standard' partition routine is that this one works
as a function returning the index of the partition key as
the value of the function. The "quicksort" procedure works
just like the standard. Just don't forget the "expose
userlist." option on the "procedure" statement, and don't
forget the period following the stem for the array to be
sorted (userlist in this case).
0 This sorting routine works swiftly and well for most
applications you might want. It looks quite nice (assuming
you adapt mnemonic variables for your particular purpose)
and is modular and simplistic in its design. It's a very
structured, maintainable exec. You do pay a price for this,
however. The recursive version uses more processor time
than its nonrecursive cousin and it is limited to a specific
allowable recursion depth by the control stack.
-
-
-
20
1
0 Vm-Com Issue 3.1
0 The nonrecursive version, example 4 below, is not
hampered by the size of the control stack and is quicker.
For sorting arrays on the order of 50-100 elements the
nonrecursive version is 8-9% faster. At 700 elements it's
about 13% faster, at 1300 it's 29% faster and at 2400
elements the nonrecursive version is 49% faster than that
using the recursion. I intended to make comparisons at
larger numbers of elements but found that when I attempted
4800 elements the nonrecursive version it took a while, but
worked just fine. When I attempted to sort 4800 elements
recursively the control stack overflowed and I was treated
by a huge series of tracebacks for my efforts.
0 Examination of example 4 will reveal two things: first,
the sorting phase looks very much like that of "partition"
from the recursive version. Second, the immitation of the
"quicksort" routine is caused by several statements which
appear rather obscure and occur before and after the
"partition" looking section of "sortit". A discussion of
the unusual parts follow the example
0 >-------Õ Example 4: The Non-Recursive QuickSort þ--------<
0 /* Rexx program to alphabetize Query Names replys */
:
:
sortit: procedure /* Sorting and outputing of users */
numuser = 0
do forever
pull qnline
hyphenloc = pos(' -',qnline)
if hyphenloc ª= 0 then
qnline = translate(qnline,' ','-')
/* Get rid of the '-' */
qnline = translate(qnline,' ',',')
/* Get rid of the ',' */
if word(qnline,1) ª= '/**/' then
do
i = 1
do forever
user = word(qnline,i)
if user = '' then leave
if hyphenloc ª=0 then i = i + 1
i = i + 1
j = i - 1
tempword = left(word(qnline,j),3)
if tempword = 'DSC' then user = insert(user,'*')
numuser = numuser + 1
userlist.numuser = user
end /* Forever */
end /* If */
else leave
end /* Forever */
- 21
1
0 Vm-Com Issue 3.1
0 /************* Begin the QuickSorting Phase ***************/
0 qsindex = 1
qsstack.qsindex.1 = 1; qsstack.qsindex.2 = numuser
do until (qsindex = 0)
qsbj = qsstack.qsindex.1; qsbi = qsstack.qsindex.2
j = qsbj; i = qsbi; k = qsbj
ijflag = 1
do until (i <= j)
if (ijflag) then
if (userlist.i < userlist.k) then do
qstemp = userlist.i; userlist.i = userlist.k
userlist.k = qstemp; k = i; ijflag = ªijflag
end
else
i = i - 1
else
if (userlist.j > userlist.k) then do
qstemp = userlist.j; userlist.j = userlist.k;
userlist.k = qstemp; k = j; ijflag = ªijflag
end
else
j = j + 1
end
0 qsindex = qsindex - 1
if (k - 1 > qsbj) then do
qsindex = qsindex + 1; qsstack.qsindex.1 = qsbj
qsstack.qsindex.2 = k - 1
end
if (k + 1 < qsbi) then do
qsindex = qsindex + 1; qsstack.qsindex.1 = k + 1
qsstack.qsindex.2 = qsbi
end
end
0 /************* End of the QuickSorting Phase *************/
0 say 'Current users:'
say
numout = 0
pline =
usenum = 1
do numuser
user = userlist.usenum
usenum = usenum + 1
user = left(user,10)
pline = insert(pline,user)
numout = numout + 1
-
-
22
1
0 Vm-Com Issue 3.1
0 if numout = 8 then
do
say pline
numout = 0
pline =
end
end /* Do */
if numout > 0 then say pline
say
say numuser 'users listed.'
return
0 >------------------Õ End of Example 4 þ--------------------<
- Notice that most of the "sortit" routine is identical to
previous versions shown of the routine. The only needed
changes have been to the part of "sortit" that actually
sorts the elements.
0 Before a discussion of the general methodology, a quick
explanation of the variables is in order. qsstack is a
double indexed array which will be used as a stack. It is
used to stack the index bounds of the array you are sorting
in immitation of the recursion. qsindex is the pointer to
the current placement in qsstack. It essentially denotes
the level of immitation recursion. qsstack.qsindex.1 is the
lower bound and qsstack.qsindex.2 is the upper bound for the
array to be sorted.
0 i is the increasing pointer and j the decreasing pointer
for the partitioning of the array to be sorted. qsbi and
qsbj are the beginning array bounds for i and j respectively
for each immitation of the recursive partition. They are
unaltered throughout the partitioning process. k is used as
the partition element or key, arbitrarily selected as the
first element of the subarray to be sorted on each
partition.
0 In fact, most of the "quicksort" phase is concerned with
the details how to partition the lists. The lines below are
really the only ones that concern themselves with the
manipulations of the stack to immitate the recursion that is
normally used to implement QuickSort.
-
-
-
- 23
1
0 Vm-Com Issue 3.1
-
:
:
1) qsindex = 1
2) qsstack.qsindex.1 = 1; qsstack.qsindex.2 = numuser
3) do until (qsindex = 0)
4) qsbj = qsstack.qsindex.1; qsbi = qsstack.qsindex.2
:
:
:
5) qsindex = qsindex - 1
6) if (k - 1 > qsbj) then do
7) qsindex = qsindex + 1; qsstack.qsindex.1 = qsbj
8) qsstack.qsindex.2 = k - 1
end
9) if (k + 1 < qsbi) then do
10) qsindex = qsindex + 1; qsstack.qsindex.1 = k + 1
11) qsstack.qsindex.2 = qsbi
end
- On line 1 (numbered for convienence at the left) the
qsindex is initialized to mean that 1 level of the array
remains to be sorted. Line 2 sets the stack of recursion to
the initial boundary values of the array to be sorted. Line
3 begins the main loop which continues until qsindex = 0.
The only time that qsindex can get to 0 is once all levels
of immitation recursion have been completed. This condition
is the same as saying do until the array is sorted.
0 Once inside the loop, line 4 sets qsbj and qsbi to
whatever array bounds are at the top of the stack. Then a
whole mess of lines which partition the array are executed.
Line 5 above decrements the qsindex because the current
level has just finished being partitioned. If there are any
sub-arrays with more than 1 element that hasn't been sorted,
then either line 6 or 9 will be true for that section of the
array.
0 If there are more than one number less than the key,
line 6 will detect it and lines 7 and 8 will first increment
qsindex to indicate that there is an additional portion of
array to sort, then the bounds for that portion are loaded
into qsstack.qsindex 1 and 2. Lines 9, 10 and 11 perform
exactly analagous functions for portions of the array which
are larger than the key and contain more than 1 element.
-
-
- 24
1
0 Vm-Com Issue 3.1
0 And that's our sermon for this week, folks.
QuickSorting in Rexx both recursively and not. Which is
better? Neither I think. If you are looking to sort a few
hundred records and are willing to sacrifice a small
percentage of time, I'd suggest you use the recursive
version because it is intuitively easier to understand and
thereby easier to modify. If, however, you wish to sort
many more, consider using a nonrecursive version. It will
save much processor time (and of course money) and if you
want to sort 4500+ records, nonrecursive QuickSort is the
only QuickSort that works!
0 Feel free to use any of the included listings, but it
requested that if you use the QuickSort presented here you
credit the author, and if you use the remainder of the code
(or a slightly modified version thereof) please credit Mark
Snelling (who was SNELLING@UMDB at the time the exec was
written).
-
-
-
-
-
-
-
-
-
-
-
-
0 25
1
0 Vm-Com Issue 3.1
0 Harried Thoughts
+ Harried Thoughts
0 Joe Herman, (HERMAN@UMDB)
- Finals. There, I've said it. The ears cringe, the heart
flutters, you break out into a sweat. For it is now that
wonderful time when you realize exactly how distracting
Because It's There NETwork has become during the semester.
You realize that those 4 projects that the professor said
were due at the end of the semester are due in under two
weeks. Panic. What to do? Why, run away of course. Just
signon to the nearest pop-philosophy channel of
RELAY@POLEVM and discuss today's degenerate world with Santa
and his elves and people called Sexy (how many of those
exist)? Or if the beeping on your screen annoys you can
delve into one of the pseudo-technical journals running
around BITNET. Anything but actually sitting down and
thinking. Just remember as you're reading this that the
semester is almost over. So after you read this, go finish
that procedure, or write another page of your Human Factors
in Computers paper.
0 I read in the Washington Post last weekend that the
United States is currently in what is called a Wartime
Economy. This means that for anyone doing defense work, the
opportunity to make money has never been better. Many
universities have gotten a slice of the pie. Keep your ears
open and you may find a position working on one of the new
grants. By the way, I don't know about other universities,
but here at Maryland if you are being paid on grant money
(non-university funds) there is no university imposed salary
limit. That means that if you're able to get a job working
on, say a NSF grant, you can ask for more than the piddly $4
or $5 the university pays. For those people who are
horrified at helping the war machine, remember this: Most
of the other programming out there is for business. That
means COBOL. 'nuff said.
0 By the way, a friend of mine discovered an interesting
but barbaric way of getting around queues for terminals.
Use punch cards. Disgusting but he said he didn't have to
wait in line for terminal and was able to get his results in
no time at all...
0 Save the Whales, adopt Charles & Di.
Joe
CHATID : Dzoey
BITNET : HERMAN@UMDD /-----›
ARPA : DZOEY@UMD2.UMD.EDU / ›
USnail : Joe Herman ³ o o ³
8553 Greenbelt Road Apt 103 ³ + ³
Greenbelt, Md 20770 › ›---/ /
› /
0 26
1
0 Vm-Com Issue 3.1
0 OpCodes
+ OpCodes
0 Various and Assorted Creative Minds...
-
AAO Add And Overflow
AB Add Backwards
AFF Add Fudge Factor
ARN Add and Reset to Non-zero
ARZ Add and Reset to Zero
AS Add Sideways
BBBB Byte Baudy Bit and Branch
BDT Burn Data TreeÕnext opcode after decorate data treeþ
CCB Chocolate Chip Byte-mode
CM Circulate Memory
COS Copy Object Code to Source File
CSL Curse and Swear Loudly
DCD Drop Cards Double
DCT Drop Cards Triple
DS Deadlock System
FCJ Feed Card and Jam
FPC Feed Paper Continuously
GND Guess at Next Digit
IAND Illogical And
INOP Indirect No-op
IOR Illogical OR
JRN Jump RaNdom
LEB Link Edit Backwards
LRD Load Random Data
MAB Melt Address Bus
MBC Make Batch Confetti
MNI Misread Next Instruction
MSGD Make Screen Go Dim
MTI Make Tape Invalid
MW Malfunction Whatever
MWT Malfunction Without Telling
PBC Print and Break Chain
PBD Print and Break Drum
PBM Pop Bubble Memory
PBST Play Batch mode Star Trek
PCR Print and Cut Ribbon
PIBM Pretend to be an IBM
PRS PRint and Smear
PSP Print and Shred Paper
PSR Print and Shred Ribbon
-
-
-
27
1
0 Vm-Com Issue 3.1
0 RCAJ Read Card And Jam
RCC Read Card and Chew
RCS Read Card, Scramble data
RCSD Read Card and Scramble Data
RLC Re-read last card
RRSG Round and Round She Goes...
SAS Sit And Spin
SCH Slit Cards Horizontal
SCOM Set Cobol-Only Mode
SEB Stop Eating and Burp
SOD Surrender Or Die!
SRZ Subtract and Reset to Zero
SSM Solve by Supernatural Means
SSP Smoke and SPark
ST Set and Test
SUI Subtract User's IQ
TPR Tear PapeR
UUBR Use Undefined Base Register
WHP Wave Hands over Problem
-
-
-
-
-
-
-
-
-
-
-
-
28
|
|