In: Computer Science
The home work is to do a survey comparing the following three
programming language:
COBOL , FOTRAN 77, and PASCAL regarding:
1- Character set.
2- Reserved(key) words and special symbols.
3- Simple data types and data structures used.
4- Control structures used (selection and loop
structures)
5- File structure used.
CHARACTER SET IN COBOL:
The most basic and indivisible unit of the COBOL language is the character. The basic character set includes the letters of the Latin alphabet, digits, and special characters. In the COBOL language, individual characters are joined to form character-strings and separators.
Basic COBOL character set.
Character Meaning Space + Plus sign - Minus sign or hyphen * Asterisk / Forward slash or solidus = Equal sign $ Currency sign1 , Comma ; Semicolon . Decimal point or period " Quotation mark2 ' Apostrophe ( Left parenthesis ) Right parenthesis > Greater than < Less than : Colon _ Underscore A - Z Alphabet (uppercase) a - z Alphabet (lowercase) 0 - 9 Numeric charactersCHARACTER SET IN FORTRAN 77:
The character set consists of the following:
Uppercase and lowercase letters, A - Z and a - z
Numerals 0 - 9
Special characters--The following table shows the special characters that are used for punctuation.
Space |
Space |
|
Tab |
Tab |
|
= |
Equals |
|
+ |
Plus |
|
- |
Minus |
|
* |
Asterisk |
|
/ |
Slash |
|
( ) |
Parentheses |
|
, |
Comma |
|
. |
Period |
|
' |
Apostrophe |
|
" |
Quote |
|
$ |
Dollar sign |
|
! |
Exclamation |
|
: |
Colon |
|
% |
Percent |
|
& |
Ampersand |
|
? |
Question mark |
|
\ |
Backslash |
|
< > |
Angle |
CHARACTER SET IN PASCAL:
A set is a collection of elements of same type. Pascal allows defining the set data type. The elements in a set are called its members. In mathematics, sets are represented by enclosing the members within braces{}. However, in Pascal, set elements are enclosed within square brackets [], which are referred as set constructor.
COBOL RESERVED WORDS:
A |
ACCEPT ACCESS ADD |
ALPHABETIC-LOWER ALPHABETIC-UPPER ALPHANUMERIC |
APPLY ARE AREA |
B |
BASIS BEFORE BEGINNING |
BINARY BLANK BLOCK |
BOTTOM BY |
C |
CALL CANCEL CBL |
COLUMN COM-REG COMMA |
COMPUTATIONAL-5 COMPUTE CONFIGURATION |
D |
DATA DATE-COMPILED DATE-WRITTEN |
DEBUG-SUB-1 DEBUG-SUB-2 DEBUG-SUB-3 |
DESTINATION DETAIL DISPLAY |
E |
EGCS EGI EJECT |
END-INVOKE END-MULTIPLY END-OF-PAGE |
ENDING ENTER ENTRY |
F |
FALSE FD FILE |
FILLER FINAL FIRST |
FOR FROM FUNCTION |
G |
GENERATE GIVING GLOBAL |
GO GOBACK GREATER |
GROUP |
H |
HEADING |
HIGH-VALUE |
HIGH-VALUES |
I |
I-O I-O-CONTROL ID |
INDICATE INHERITS INITIAL |
INSPECT INSTALLATION INTO |
J |
JUST |
JUSTIFIED |
|
K |
KANJI |
KEY |
|
L |
LABEL LAST LEADING |
LIMIT LIMITS LINAGE |
LINES LINKAGE LOCAL-STORAGE |
M |
MEMORY MERGE MESSAGE |
METHOD METHOD-ID MODE |
MORE-LABELS MOVE MULTIPLE |
N |
NATIVE NATIVE_BINARY NEGATIVE |
NO NOT NULL |
NUMBER NUMERIC NUMERIC-EDITED |
P |
PACKED-DECIMAL PADDING PAGE |
PIC PICTURE PLUS |
PROCEDURE-POINTER PROCEDURES PROCEED |
Q |
QUEUE |
QUOTE |
QUOTES |
R |
RANDOM RD READ |
RELATIVE RELEASE RELOAD |
RESERVE RESET RETURN |
S |
SAME SD SEARCH |
SIGN SIZE SKIP1 |
STANDARD STANDARD-1 STANDARD-2 |
T |
TABLE TALLY TALLYING |
TEXT THAN THEN |
TITLE TO TOP |
U |
UNIT UNSTRING UNTIL |
UP UPON USAGE |
USE USING |
V |
VALUE |
VALUES |
VARYING |
W |
WHEN WHEN-COMPILED WITH |
WORDS WORKING-STORAGE WRITE |
WRITE-ONLY |
Z |
ZERO |
ZEROES |
ZEROS |
FORTRAN RESERVED WORDS:
Unlike most other languages, Fortran does not have any reserved words. Although it is possible to use words that the language is built upon as variable names if the context shows that it can't be meant as a keyword, this can become very confusing and is therefore not recommended.
and | array | begin | case | const |
div | do | downto | else | end |
file | for | function | goto | if |
in | label | mod | nil | not |
of | or | packed | procedure | program |
record | repeat | set | then | to |
type | until | var | while | with |
RESERVED WORDS IN PASCAL
DATA TYPES IN COBOL:
There are mainly five data types in COBOL.
DATA STRUCTURES IN COBOL:
A COBOL copybook is a selection of code that defines data structures. If a particular data structure is used in many programs, then instead of writing the same data structure again, we can use copybooks. We use the COPY statement to include a copybook in a program. COPY statement is used in the WorkingStorage Section
DATA TYPES IN FORTRAN 77:
Fortran 77 Data Type | Size |
---|---|
BYTE X CHARACTER X CHARACTER* n X | 1 1 n |
COMPLEX X COMPLEX*8 X DOUBLE COMPLEX X COMPLEX*16 X COMPLEX*32 X | 8 8 16 16 32 |
DOUBLE PRECISION X REAL X REAL*4 X REAL*8 X REAL*16 X | 8 4 4 8 16 |
INTEGER X INTEGER*2 X INTEGER*4 X INTEGER*8 X | 4 2 4 8 |
DATA STRUCTURES IN FORTRAN 77:
The STRUCTURE @ statement organizes data into structures.
STRUCTURE [/structure-name/] [field-list]
field-declaration
field-declaration
. . .
END STRUCTURE
DATA TYPES IN PASCAL:
There are four simple scalar data types in Pascal: INTEGER, REAL, CHAR and BOOLEAN.
DATA STRUCTURES IN PASCAL:
An array is a data structured whose domain is a finite subset of Euclidean n-space Rn. Observation. Arrays in PASCAL are assigned the datatype of the elements that they contain, which can bee one and only one datatype.