Posts

Showing posts with the label Cobol

Freedom of assembly

Image
Assembly language is closer to what a computer understands and less like what a human would understand. but it is fast and compact. when assembled and linked vs a compiled higher level program. Assembly language version of Hello world:   section .data hello: db 'Hello world!',10 ; 'Hello world!' plus a linefeed character helloLen: equ $-hello ; Length of the 'Hello world!' string ; (I'll explain soon) section .text global _start _start: mov eax,4 ; The system call for write (sys_write) mov ebx,1 ; File descriptor 1 - standard output mov ecx,hello ; Put the offset of hello in ecx mov edx,helloLen ; helloLen is a constant, so we don't need to say ; mov edx,[helloLen] to get it's actual value int 80h ; Call the kernel mov eax,1 ; The system call for exit (sys_exit) mov ebx,0 ; Exit with return ...

Yet another chit chat.

Image
After installing Cobol on the Nslu2 running Debian, still had to load some libraries after and update to Debian. A learning experience.  One of the test programs I played with to relearn cobol. Cobol is so self documenting. ~$ ./readtest 6543218 Mend ed 1234 1957 1234567 Corona ra 5555 1958 :~$ cat STUDENTS.DAT 6543218Mend ed  195707141234m 1234567Corona ra195806135555f ~$ ~$ cat readtest.cob IDENTIFICATION DIVISION. PROGRAM-ID. SeqReadNo88. AUTHOR. Michael Coughlan. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT StudentFile ASSIGN TO "STUDENTS.DAT" ORGANIZATION IS LINE SEQUENTIAL. DATA DIVISION. FILE SECTION. FD StudentFile. 01 StudentDetails. 02 StudentId PIC 9(7). 02 StudentName. 03 Surname PIC X(8). 03 Initials PIC XX. 02 DateOfBirth. 03 YOBirth PIC 9(4). 03 MOBirth PIC 9(2). 03 DOBirth PIC 9(2). 02 CourseCode PIC X(4). 02 Gender PIC X...

Incredibly shrinking computer.

Image
Computers are getting smaller and smaller. We use them to solve problems, but you still have to give them instructions to do what you want. Computer languages are a way to give the computer the instructions you want it to use.  The first computer I ever used was at college. Then they did not even have a computer major. Mostly you majored in math. The first computer was large and bulky. We used punch cards to get computer code into the machine. In fact, we used a language call Fortran (Formula translation) which was the forerunner of a more recent language called Basic (Beginner's all purpose instruction code).  Fortran is still actually around and you can still use it. On Linux it is sometimes called gfortran. Basic has evolved into so many variations that are too many to mention though you may have heard of VB.net. Personally I prefer Quickbasic variations for my non-gui systems. The next computer I used in the Professional world was the Datapoint Terminal in the days o...