Code is Poetry

Code is Poetry: DataBus

by Rob on

Some time ago I started a series of postings about the programming-languages I worked with. For some reason I never continued that. Well, time to change that.

I worked about 9 years in a language called DataBus. This language still exists, but is called these days PL/B (Programming Language for Business). It was developed by the company Datapoint Inc to use on their mini-computers.

As said, Databus was originally developed for mini-computers, but later on version for many other environments were created as DOS, Windows, Unix/Linux, AS400 and so on.

DataBus is what they call a semi-compiler language. This means that the source-code is optimized and converted to a binary format. But a second program, called an Interpreter, is needed to execute the application. The Interpreter will “translate” the optimized code to machine instruction which a computer can understand and do something with.

DataBus used to be very popular in the automation of hospitals. It was very good for administrative applications and that was where it was designed for.

Personally I saw the syntax of DataBus always a weird mixture of Pascal, Cobol and C. I was very amazed to hear hat Databus (or rather PL/B) is still used by big companies as Boeing and Holiday-Inn.

Below an example of Databus:

.——————————————————————————————–
.
. SIMPLE READ SEQUENTIAL INTO A LIST
.
CustRecord LIST
theCustomerNo DIM 5
theCustomerName DIM 40
theCustomerAmount FORM 9.9
LISTEND
.
odbcOPEN “MyDSN”,”DEFAULTUSER”,”PASSWORD”
.
odbcREAD 1,”* from CustomerTable”
LOOP
odbcREADKS 1,CustRecord
WHILE NOT OVER
DISPLAY theCustomerNo,” “,theCustomerName,” “,theCustomerAmount
REPEAT
.
odbcCLOSE
.
.——————————————————————————————–



No comments to this article yet. Press "Continue Reading" to add a comment.

Code is Poetry – ZX81 Basic

by Rob on

Yesterday when I was traveling back to Amsterdam I suddenly a very nice idea for a series of articles here on my weblog.

As many know I am a software engineer (or a programmer as they called that in the past :P). In the more then the 20 years I am coding I have seen many programming languages. It should be fun for me to take a look back at them all and maybe it is also nice for those who have an interest in this area. So every now and then I will give one of the languages I have worked or am working with some special attention.

I will start with a review of ZX 81 Basic. The ZX 81 was one of the first home computers that came out in the early 1980’s. It had a build in Basic version.

Basic (Beginners All-purpose Symbolic Instruction Code) was not really meant to develop in, but it was meant to learn programming. Most Basic-versions were interpreter language, which meant on execution of the program the original source was translated to system instruction (commands that a computer can understand and execute).

ZX 81 Basic was a very minimal version of Basic. The instruction set is very limited.

Interesting was though that while you where enter code, ZX 81 Basic completed the instruction for you. So when you entered an “I’ it knew when you meant just an “I” or you needed the “if” instruction and display the complete instruction on the screen. It did this pretty good.

ZX81 Basic did not have any really graphic functions. After all it was complete black/white and the only way to do anything with plotting small blocks on the screen.

Below a typical example of piece of ZX81 Basic code. Looking at it, I would have done some thing different, but as said…. “Code is Poetry” , so it is all up to the coder :

1000 REM recursive subroutine
1010 IF x>8 OR x<1 OR y>8 OR y<1 THEN RETURN
1020 IF b$(s,1)<>a$(y,x) THEN RETURN
1030 IF SCREEN$ (20-y*2,2+x*3)<>” ” THEN RETURN
1040 PRINT AT 20-y*2,1+x*3; PAPER 5+((y+x)=INT ((y+x)/2)*2);(” ” AND s<10); s
1050 IF s=64 THEN PRINT AT 21,8;”SOLVED IN “;m; ” MOVES” : STOP
1060 LET s=s+1: LET b$(s)=”23456789″: LET m=m+1
1070 LET x=x+x2: LET y=y+y1: GO SUB 1000: LET y=y-y1: LET x=x-x2
1080 LET x=x+x2: LET y=y-y1: GO SUB 1000: LET y=y+y1: LET x=x-x2
1090 LET x=x+x1: LET y=y+y2: GO SUB 1000: LET y=y-y2: LET x=x-x1
1100 LET x=x+x1: LET y=y-y2: GO SUB 1000: LET y=y+y2: LET x=x-x1
1110 LET x=x-x1: LET y=y+y2: GO SUB 1000: LET y=y-y2: LET x=x+x1
1120 LET x=x-x1: LET y=y-y2: GO SUB 1000: LET y=y+y2: LET x=x+x1
1130 LET x=x-x2: LET y=y+y1: GO SUB 1000: LET y=y-y1: LET x=x+x2
1140 LET x=x-x2: LET y=y-y1: GO SUB 1000: LET y=y+y1: LET x=x+x2
1150 IF b$(s)>=”0″ THEN LET b$(s)=b$(s,2 TO ): GO TO 1070
1155 LET s=s-1 : REM obsolete backtracking path
1160 PRINT AT 20-y*2,1+x*3; PAPER 8;” ”
1170 RETURN

Edit:  Somehow the code example was messed up. There were some codes in there that were translated as HTML, which it should not. It looks now a lot better I have to say.


11 comments to this article, press "Continue Reading" to view them or to add a commment.