How to Program In Algol for MainFrame - ByteScout
  • Home
  • /
  • Blog
  • /
  • How to Program In Algol for MainFrame

How to Program In Algol for MainFrame

Are you looking to learn about how to program in ALGOL programming language for mainframe computers? If you do, then you have come to the right place.

ALGOL is undoubtedly one of the most influential languages out there. It became popular in the era of other influential programming languages such as COBOL, Fortran, and so on!

Algol Programming

What Makes ALGOL so special?

So, what made ALGOL so special? It is because it influenced other languages and is also used to describe algorithms in textbooks until modern programming languages were introduced.

ALGOL builds upon the FORTRAN failure by offering better design and implementation. It is also one of the first programming languages that defined code blocks.

The first ALGOL version was ALGOL 58 where it.

In this article, we will explore ALGOL and how you can use it for mainframe programming.

Let’s get started.

How To Program In Algol Programming Language For MainFrame Computers

To make sure that we are on the same page, we are going to use ALGOL 68.

Program Structure

The first thing that you need to learn is the program structure. Each of the ALGOL 68 programs starts with “begin” and then finishes with “end”.

The syntax would read like below.

begin
            Insert code here
end

Apart from that, an ALGOL 68 program can do the following:

  • Symbols can be written in boldface type so that they are distinguishable from keywords
  • Carriage returns and space can be used to improve readability
  • Comments can be represented by four symbols: comment, co, #, and ¢.

Data and Decelerations

ALGOL 68 uses modes instead of “type” to detonate the data type. For example, there is Boolean, character, real, and integer. Just like modern programming languages, these variables need to be declared before they can be used.

begin
real a,b,c,d,
bool nit
int x,y,z,employee
end

Statements

Next, we come to statements. In ALGOL 68, every statement yields value. This is because ALGOL is an expressive language where the value is shown on the right-hand side of the assignment.

Apart from that, it supports if statements, for statements, case statements, while statements, and goto statements. If you ever programmed before, you will find all of these statements familiar to you.

if x> 5
then print (“impressive”) else print (“nope”)
fi
 

We also have else-if which is represented as the elif keyword. It can be used as below.

if word = “abc”

            then print(“new born”)
            elif word = “pizza”
              then print (“teen”)
            elif word = “money”
              then print (“adult”)
              else print (“alien”)
fi

You can run conditions based on the if statement. Moreover, you can also use loops to do an operation multiple times.

Let’s see a for loop example.

for k from 1 by 1 to j+2
do print (new line) od; 

In contrast, the while- do loop works as below.

while x<y V a<0
            do x:= x+ 1;
                 y = y+ 1;
     print((i,j))
            od;

Modes in Algol 68

There are multiple modes that are part of the ALGOL 68 programming languages. These modes are simply data types and can be divided into primitive modes, array modes, structured modes, united modes, reference-to, and procedure modes.

 

These data types enable you to handle the different data in your ALGOL 68. As a programmer, you need to decide beforehand what type of data type you want to use, depending on your approach.

What’s Next?

This is just the beginning when it comes to programming in ALGOL programming language for mainframe computers. With the above knowledge, you can get started with the language itself.

So, what program are you going to build for the mainframe using ALGOL 68? Comment below and let us know.

 

   

About the Author

ByteScout Team ByteScout Team of Writers ByteScout has a team of professional writers proficient in different technical topics. We select the best writers to cover interesting and trending topics for our readers. We love developers and we hope our articles help you learn about programming and programmers.  
prev
next