add mymort1 example program

This commit is contained in:
Greg Gauthier 2025-01-16 17:27:50 +00:00
parent 8066c9c85e
commit 8832f57a8e

View File

@ -37,3 +37,48 @@ Here's the original comment flower box from the core BASIC/360 compiler module,
000031 ********************************************************************/ 000031 ********************************************************************/
``` ```
Here's a copy of the very first BASIC program. A simple mortgage calculator that I copied directly from the Dartmouth Time-Share System BASIC implementation. This program runs as-is, in BASIC/360:
```basic
000001 1 REM MORTGATE COMPUTER
000002 10 DATA 0.05,28500,170,1,1964
000003 50 READ I,P,P1,M,Y
000004 60 LET R=1+I/12
000005 70 PRINT "YEAR", "PRINCIPLE"
000006 80 PRINT Y,P
000007 90 LET P=P*R-P1
000008 100 IF P>0 THEN 120
000009 110 LET P=0
000010 120 LET M=M+1
000011 130 IF M>12 THEN 160
000012 140 PRINT " ",
000013 150 GOTO 190
000014 160 LET M=1
000015 170 LET Y=Y+1
000016 180 PRINT Y,
000017 190 PRINT INT(P)
000018 200 IF P>0 THEN 90
000019 210 END
```
To run this on MVS, you need a JCL job card deck, to define the batch job to the system. Here's a version that is designed to run interactively. I'm using this JCL, because the program in "monitor" mode is designed to self-terminate after 5000 iterations of a loop. This "interactive" version will produce the complete set of output.
```jcl
000001 //@050541 JOB (BASIC),'BASIC INTERACTIVE',NOTIFY=&SYSUID,
000002 // CLASS=S,
000003 // MSGCLASS=A,
000004 // MSGLEVEL=(1,1)
000005 //*
000006 //* BASIC INTERACTIVE
000007 //*
000008 //S1 EXEC PGM=BASIC1UP
000009 //STEPLIB DD DSN=SYSC.LINKLIB,DISP=SHR
000010 // DD DSN=SYSC.PL1LIB,DISP=SHR
000011 //SYSPRINT DD SYSOUT=*
000012 //RENUMFL DD DUMMY,DCB=BLKSIZE=80
000013 //SYSIN DD DSN=@05054.SRCLIB.BASIC(MYMORT1),DISP=SHR
000014 //KEYINPT DD *
000015 "THIS IS A TEST"
000016 //
```
Mainframe batch jobs are designed from the start to produce printed output. They were written in an era where end-user applications presented interactively on a screen were not really an option. The only people who had screens were engineers, system operators, and programmers. Everyone else interacted with computers by way of printed output. To see the output from this program, you can [download it here](http://gmgauthier.us-east-1.linodeobjects.com/docs/mymort1.pdf).