Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 9

CHAPTER

1
0PROGRAMMING

LANGUAGES

Most courses in programming begin with a lesson on the binary system, although most I
programmers seldom have to us'e the binary numbers in actual practice. The reason for
studying the binary system is to understand the nature of the computer and the way it
operates. Understanding the binary system and its correspondence to the switches inside the
machine helps to take the mystery out of computers. Above all, it is the programmer 5 who
must realize that the machine is controlled by human beings — and that he is the one who is
going to control and direct it.

We know that the machine reacts to series of electrical impulses that can be represented in
binary numbers. This is called machine language, and the central processing unit has been
designed to execute instructions given to it in machine language. We also know that 10 all data
are translated into binary code before being stored in main storage. It would, however, be very
tedious and difficult to write all information in binary code. Most programmers therefore use
one or more of the standard programming languages to prepare their programs. These
programming languages use a combination of numbers, characters, and other symbols that is
more convenient and easier to work with than machine lan- 15 guage.

There are many programming languages. They are known by such names as FORTRAN,
COBOL, ALGOL, PL/1, and APL. FORTRAN is used primarily for scientific work, and
COBOL is used for most commercial applications. COBOL and FORTRAN are the most
common of the programming languages. Of the others, ALGOL and APL are used 20 primarily
for scientific work, while PL/1 is employed for general-purpose programming.

57
How does the machine understand statements in one of these languages if the only language to
which the machine can react is machine language? It understands by means of interpreter, just
as an American diplomat at the United Nations communicates with a Chinese diplomat through
an interpreter. The interpreter for a computer is a system 25 program. The systems programs are
part of the software, but they are supplied by the manufacturer of the machine. One of the
systems programs is called the compiler. The compiler takes each instruction in the program
and translates it into machine language that is, into a binary equivalent. It is this translated
program that activates the millions of switches in the machine during processing. There is a
separate compiler for each of 3() the standard programming languages.

As we have said, only two of the programming languages are very common; they are COBOL
and FORTRAN. COBOL is used primarily for problems related to business. In fact, COBOL
stands for common business-oriented language. It is used for problems that do not involve a
great deal of mathematical manipulation but do involve data collection 35 and processing.
FORTRAN, on the other hand, is based on mathematical principles. It stand for formula
translation. It is used primarily for solving scientific problems, particularly those involving a
great deal of mathematical calculation.

Sample program written in COBOL


Sample program written in COBOL.

COBOL E DATE 75.09 1 1


IDENTIFICATION DIVISION.
2 PROGRAM-ID. 'H EADINGS ' .
3 ENVIRONMENT DIVISION. INPUT-
OUTPUT SECTION. s FILE-CONTROL.
SELECT CARD-FILE ASSIGN TO IRDRIN ' UNIT-RECORD 250 I R.
7 SELECT PRINT-FILE ASS 1611. TO 'TAPEOUT' UNIT-RECORD 1403.
8 I- O-CONTROL.
9 DATA DIVISION. FILE SECTION.
11 CARD-FILE,
12 RECORDING MODE IS F
LABEL RECORDS ARE
OMITTED 14 DATA RECORD IS CARD-
DATA.
2.5 01 CARD-DATA.
16 02 CD-MEYN PICTURE 9(05 ).
FILLER PICTURE x ( 04) . 02CD-NAME
PICTURE x ( 21 ) . 02 FILLER
PICTURE XXX.
20 02 FILLER PICTURE . X.
21 02 CD-STRAD PICTURE x ( 21).
02 CD-ZI P PICTURE x ( 21 ) •
23 Y IC IURE x ( 04
24 PRINT-FILE
25 LABEL RECORDS ARE OMITTED
26 RECORDING MODE I S F 27 DATA RECORD I S PRINT.
23 01 PRINT.

58
29 02 PICTURE 9<05 ) .
30 02 FILLER PICTURE XX.
31 02 FILLER PICTURE 32 02 TP-NAHE PICTURE x ( 18 ) .
33 02 FILLER PICTURE X .
02 TP-STRAD PICTURE x ( 21 ) .
35 02 FI LLER PICTURE X (04 ) .
36 02 T p - ZI P PICTURE x ( 21 ) .
37 WORKING-STORAGE SECTION.
38 77 NETW PICTURE 999V99.
39 01 HEADING-ONE.
40 02 FI LLER PICTURE xxx VALUE SPACES.
41 02 FILLER PICTURE VALUE 'DEPT/ . 02 FI LLER PICTURE
VALUE SPACES .
02 FILLER PICTURE VALUE t HAN / .
02 F l Ll.ER PICTURE VALUE SPACES .
45 02 FILLER PICTURE VALUE 'GROSS I .
02 FILLER PICTURE VALUE SPACES .
47 02 F I LLERPICTURE x ( 10 )VALUE 'DEDUCTIONS ' .
02 FI LLER PICTURE VALUE SPACES .
02 FI LLER PICTURE VALUE 'NET 1 .
50 02 FI LLER PICTURE VALUE SPACES .
51 HEADING-THO •
52 02 FILLER PICTURE VALUE SPACES.
53 02 FILLER PICTURE VALUE / NUMBER ' 02 F I LL EP PICTURE
VALUE SPACES.
02 FI LLER PICTURE VALUE 'NUMBER ' .
FILLER PICTURE VALUE SPACES . 57 02 FILLER
PICTURE VALUE 1 PAY 1 .
02 FILLERPICTURE x ( 23 )VALUE s p ACES .
59 02 FILLER PI CTURE VALUE
60 02 FI LLER PICTURE x (78 ) VALUE SPACES .
61 PROCEDURE DIVISION.
62 OPEN- FILES .
63 OPEN INPUT CARD-FILE, OUTPUT PRINT-FI LE. P,70CESS-DATA.
65 READ CARD-FILE AT END CLOSE CARD-FI LE , PRINT-FI LE;
STOP HOVE SPACES TO PRINT.
67 HOVE 'THE OUTPUT BUFFER-AREA STARTS HERE/ TO PRINT.
ADD CD-HEMN TO TP-MEMN.

69 MOVE CD-NAME TO TP-NAME.


70 HOVE CD-STRAD TO TP-STRAD.
71 HOVE CD-ZIP
72 WRITE PRINT ADVANCING 1
AFTER LINES
73 GO TO PROCESS-DATA.
74 HEAD : NG-ROUTINE.
75 WRITE PRINT FROM HERDING-ONE AFTER ADVANCING
LINES . 76 WRITE PRINT FROM HEADING- ONE
AFTER ADVANCING 1 LINES .
77 GO TO PROCESS- DATA.
EX I T .

59
While most programmers have experience in several languages, they generally specialize 39
in one programming language. This is because each language has many intricates and
peculiarities that make it necessary for a programmer to use the one in which he specializes
constantly in order to do an efficient job.

Programs written in a programming language are referred to as source programs. The same
programs are called object programs when they have been transformed into a machine
language so that they can beeexecuted. Programs that are designed to solve 45 specific
problems in business or science are called applications programs. They are distinguished from
system programs, which direct the processing and also organize and coordinate the flow
throughout the entire computer system, including the input/output and secondary storage
devices.

In addition to the business and science-oriented standard programming languages, a 50


special one is used for systems programs. It is called JCL, which stands for job control
language. JCL is used for the programs that control the central processing unit and the entire
computer system as well. It is therefore a highly specialized field. JCL programmers are
frequently known as systems programmers.

Let's follow a typical program through the computer. Mr. Pratt has just placed his 55
FORTRAN source program in the card reader. The first thing that occurs is that a systems
program is called for. The systems program in this case is the FORTRAN compiler. The
compiler is executed with the source program as its data. This produces 58 a program in
machine language that is called the object module or object program.
JOAQU IN •WONG
c TH I S PROGRAM
PREPARES AN ACCOUNTS
RECEIVABLE REPORT
PRJIOOIO c
0020
1500
0030
2 600
0040
3 1
0050
4
0060

5 2BALNEW=OLDBAL- PAYMNT
0070
6

60
7 GO TO 1 0080
0090
8 3 STOP
9 END 0100
0110

Sample program written in FORTRAN.


If it happens that Mr. Pratt's program requires information that is on a disk, for example, 60 the
system must look for this and join it to the object module. This joining is done by another
systems program called the linkage editor. After this step is completed, we have a program that
can be executed that is called the load module. The load module is simply the object module
together with any other data that are needed to carry out the program. 64 The compiler, linkage
editor, and other systems programs are written in JCL.

In order to execute a program, many intermediate steps have to occur. Fortunately for most
programmers, the JCL operations have already been prescribed by someone else. They do not
concem the person who is preparing the application program.

In addition to programming skills, it is an advantage for the programmer to have experience in


some other field as well in order that he can understand what he is program- 70 ming. When he
can combine technical expertise with programming, he will be able to move ahead into work
that is particularly rewarding to him.

Let's take Mr. Fontaine as an example. He works for a large intemational computer firm.
Currently, he is on assignment to a large petroleum fim that is installing a new computer system
and therefore wants a package of programs to deal with the tindings of their 75 geologists. Mr.
Fontaine's program will eventually be part of the standard software at this computer installation.
One of his project is to interpret data on soil samples and try to predict where there may be large
oil deposits. Because Mr.Fontaine studied geology and physics in collage, he has a good idea of
what kind of programs to write for this 79 company.

Mr. Fontaine likes his job, but he is tired of traveling as often as he does. The chances are
that some day one of the companies he is temporarily assigned to will offer him a permanent
job. He will accept the offer because he misses his family when he has to go from place to
place so frequently.

The same company that employs Mr. Fontaine also employs Mr. Ross. Mr. Ross studied 85
business school and now he specializes in accounting systems for large corporations. Unlike Mr
Tontain, Mr Ross loves traveling. Since he is a bachelor, he does not find moving around an

61
inconvenience. In fact, he considers it an adventure. He does not want to take a permanent job
at one computer installation. Instead, he prefers to work for a large computer firm that sends
him to many different parts of the country. (The Lan- 9() guage of Computer Programming in
English, John C. Keegel)

EXERCISES
A. Answer the following questions!

1. How do we understand the nature of the computer and they way it operates?
2. What helps us take the mystery of the computers?
3. What is the name of series of electrical impulses to which the machine reacts ?
4. Why do most programmers use one or more of the standard programming languages to
prepare their program?
5. What is used in the programming languages?
6. What is FORTRAN primarily used for?
7. What is COBOL primarily used for?
8. What language is used for general-purpose programming?
9. What language does the computer can react? 10. How does a compiler work in the
computer?
11. What does COBOL stand for?
12. What type of business problem is COBOL usually used for?
13. What does FORTRAN stand for?
14. Although most programmers have experience in several languages, why do they generally
specialize in one programming language?
15. What are source programs?
16. What are object programs?
17. What are application programs?
18. What does a system program function?
19. What is JCL? Explain its functions!
20. What is the linkage editor?
21. Explain what load module is!
22. Why is it an advantage for a programmer to have experience in some other fields?

62
B. Cross T " for the true statements and " F " for the false !
F 1. Binary numbers are rarely used in preparing programs.
F 2. It is the programmer who is going to control and direct the machine.
F 3. The machine cannot react to the standard programming languages directly. F 4. It is
the compiler which translates each instruction in the program into binary equivalent.
F 5. Having been stored in the main storage, all data are then translated into binary code.
F 6. The most common of programming languages are mostly used for commercial and
scientific work.
7. Computer can understand the statements of the programming languages
directly.
F 8. All of the standard programming languages have the same compiler.
F 9. Programs written in JCL are called source program.
F 10. It is the application program that manage the input and output.
F 'l l . Programmers who writes programs in JCL are usually called system
programmers

C. Look at the text again and find out what the bold words refer to.

1. the way it operates (1. 3)


2 instructions given to it (l. 10)
3. to prepare their programs (I. 14)
4. They are known by such names (1. 17)
5. the only language to which the machine can react (l. 23)
6. It understands by means of interpreter (1. 23)
7. they are supplied by manufacturer (1. 26)
8. only two of the programming languages (1. 32) 9. It is used for problems (I. 34)

10. those involving a great deal of mathematical calculation (1. 38)


11. they generally specialize in one programming language (1. 39)
12. to use the one in which he specializes (1. 41)
13. They are distinguished from system programs (1. 46)
14. with a source program as its data. (l. 58)
15. They do not concern the person the person (1. 68)
D. VOCABULARY

63
Find out the synonyms (words having similar meaning) of the following words in the text!

1. real
2. essence
3. respond
4. monotonous (1.12)
5. practical(1.15)
6. trading (l. 19)
7. provided (1.26)
8. complexities (1.40)
9. etemally (1.42) 10. often (1.54) l l . needs (1.60)
12. happen (1.66)
13. proficiency (1.69)
14. forecast (1.78)
15. concept (1.79)

Find out the antonyms (words having an opposite meaning) of the following words in the
text!

16. end
17. after (1.1 1)
18. interesting (1.12)
19. rare (1.20)
20. engaged (1.21)
21. the same (1.30)
22. needless (1.41)
23. primary (1.49)
24. unluckily (1.66)
25. permanently (1.82)
STRUCTURES
Degrees of Comparision
(Superlative Degree)

To form the superlative degree of one syllable adjectives or adverbs, we add est to them.
small smallest tall tallest bright
brightest fast fastest

64
For Adjective and adverbs with more than two syllable we use most.
beautiful most beautiful expensive most expensive
quickly most quickly directly most directly

But good, bad, little, much, many, well, and badly havespecial forms.
good best bad worst well
best badly worst little least
much most many most

The form of the superlative degree of adjectives and adverbs is preceded by the. Study the
following examples:

She is the most diligent girl in our campus.


"C" is the most difficult programming language I learned.
This letter is the most neatly written.
Your letter is the most quickly replied.

Supply the superlative form of the adjectives and adverbs in parentheses!

1. Michael is . (young) worker in this company.


2. I think our building is ... (beautifully) designed in this city.
3. Electronic Data Processing is . (important) part in your company.
4. Chapter five questions are . (difficult) in this book.
5. This idea can be ... (good) topic in the next seminar.
6. Mt. Everest is ... (high) mountain in this globe.
7. Blue back ink is ... (commonly) used in my class.
8. She is . (intelligent) girl in my family.
9. The question number three is . (easily) answered in that exercises.
10. Indonesia is ... (large) country in the South East Asia.

65

You might also like