Created
July 11, 2017 12:44
-
-
Save samba2/796635fb221502f3a81b70615a4be570 to your computer and use it in GitHub Desktop.
Fibonacci sequence in COBOL including JCL to run it on Turnkey 4 (MVS)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//FIBCOB JOB (SETUP), | |
// 'Fibonaci Numbers', | |
// CLASS=A, | |
// MSGCLASS=H, | |
// MSGLEVEL=(1,1) | |
//FIB EXEC COBUCLG | |
//COB.SYSIN DD * | |
010 IDENTIFICATION DIVISION. | |
020 PROGRAM-ID. 'FIBCOB'. | |
030 ** | |
040 DATA DIVISION. | |
050 WORKING-STORAGE SECTION. | |
060 77 MAX-VALUE PIC 9(10) VALUE 150. | |
070 77 FIB1 PIC 9(10) VALUE 0. | |
080 77 FIB2 PIC 9(10) VALUE 1. | |
090 77 TMP PIC 9(10). | |
100 ** | |
110 PROCEDURE DIVISION. | |
120 LOOP. | |
130 PERFORM CALC UNTIL FIB2 GREATER MAX-VALUE. | |
140 STOP RUN. | |
150 ** | |
160 CALC. | |
170 DISPLAY FIB2 UPON CONSOLE. | |
180 ADD FIB1 TO FIB2 GIVING TMP. | |
190 MOVE FIB2 TO FIB1. | |
200 MOVE TMP TO FIB2. | |
//LKED.SYSLIB DD DSNAME=SYS1.COBLIB,DISP=SHR | |
// DD DSNAME=SYS1.LINKLIB,DISP=SHR | |
//GO.SYSPRINT DD SYSOUT=A | |
// |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment