- Get TK4- MVS Sofware
- Get wc3270 Terminal Emulator
- Install wc3270 Terminal Emulator
- Install and Run MVS 3.8j
- Logging In to/Out of MVS 3.8j
- Shutting down MVS 3.8j from TSO
- Using TSO RFE Application
- Adding a User
- Creating Datasets
- JCL Overview
- Your First Cobol Program
- Your First Assembler Program
- Your First Fortran Program
- Your First PL/1 Program
|
Your First Fortran Program
Fortran was one of the first compilers. It was created in 1957 by IBM and version have
been made by virtually every operating system vendor. The first standardized version of
Fortran was in 1966 and named FORTRAN IV. IBM created a couple of versions of Fortran IV named Fortran G and
Fortran H. They were for machines with different memory. MVS 3.8J has both compilers.
For many years fortran was heavily used in science, engineering, and math. It is no
longer used as heavily as in the past.
Let's go over the Fortan code
A cobol line consists of three different sections. Positions 1 - 6 are for a line id. If position 7
is not blank, then the line is a continuation of the prior line. Positions 8 - 72 are for code.
000001 110 FORMAT( ' NAME IS ' 20A1)
000002 120 FORMAT(20A1)
000003 LOGICAL*1 NAME(20)
000004 READ(5,120) (NAME(I),I=1,20)
000005 WRITE(6,110) NAME
000006 STOP
000007 END
Line # | Description |
1 | This line has an ID number allowing the line to be referenced in certain statements. The
code portion is the Format statement which is defining a print line. The ' NAME IS ' is a constant and
is followed by the 20A1 which means that it will display 20 alpanumeric 1 character fields. |
2 | This line also had an id number and is a format statement defining a 20
alphanumeric fields that are 1 character long. |
3 | This defines a LOGICAL field that is 1 character long and is an
array of 20. |
4 | This statement reads from device 5 using the format defined in id 120. It reads
into the array NAME starting at index 1 and going through index 20. This is done this way so that it can
read a 20 character name from the sysin (device 5) input. Fortran IV Compilers did not have good support
for string fields and defining name as 20 1 charcter fields allows compiler to essentially fake a string. |
5 | This statement writes on device 6 using the format from id 110 and outputs the name
array. Device 6 is defined in the JCL that runs this code. |
6 | Tells the program to stop execution. |
7 | Indicates that this is the physical end of the program. |
Embedded Source
JCL Job Stream with embedded source
//RLAWFRT2 JOB (FORTRAN),CLASS=A,MSGCLASS=H,MSGLEVEL=(1,1)
//FIRSTPGM EXEC FORTHCLD,REGION.FORT=384K,PARM.FORT='LIST'
//FORT.SYSIN DD *
110 FORMAT( ' NAME IS ' 20A1)
120 FORMAT(20A1)
LOGICAL*1 NAME(20)
READ(5,120) (NAME(I),I=1,20)
WRITE(6,110) NAME
STOP
END
/*
//GO.FT06F001 DD SYSOUT=*,DCB=(RECFM=FBA,LRECL=132,BLKSIZE=13200)
//GO.SYSIN DD *
GEORGE WASHINGTON
//
Notice the line GO.FT06F001, the 6 indicates that this is the DD line for device 6 in the
program.
External Source
JCL Job Stream with external source
//RLAWFRT2 JOB (FORTRAN),CLASS=A,MSGCLASS=H,MSGLEVEL=(1,1)
//FIRSTPGM EXEC FORTHCLD,REGION.FORT=384K,PARM.FORT='LIST'
//FORT.SYSIN DD DSN=LEARN.FORTRAN.SRC(FIRSTPGM)
//GO.FT06F001 DD SYSOUT=*,DCB=(RECFM=FBA,LRECL=132,BLKSIZE=13200)
//GO.SYSIN DD *
GEORGE WASHINGTON
//
|
|