Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-06 - 43,50406/comput.cbl
There are 2 other files named comput.cbl in the archive. Click here to see a list.
00010 * COMPUT.CBL NADDOR/SHARKEY JAN 76.
00015	IDENTIFICATION DIVISION.
00020   DATA DIVISION. 
00025   WORKING-STORAGE SECTION. 
00026   77  A PIC S99V9999. 
00027   77  B PIC S99V9999. 
00030	01  P PIC X(63) VALUE "            A+B   A-B     A*B     A/B     
00031 -     "A^B   MIN   MAX   HYP".
00035   01  R. 
00040	    02 S0 PIC X(10) VALUE SPACES.
00041	    02 X1 PIC      --9.9.
00042	    02 X2 PIC     ---9.9.
00043	    02 X3 PIC    ----9.99.
00044	    02 X4 PIC     ---9.999.
00045	    02 X5 PIC ----,--9.
00046	    02 X6 PIC     ---9.9.
00047	    02 X7 PIC     ---9.9.
00048	    02 X8 PIC     ---9.9.
00050   PROCEDURE DIVISION. 
00051	    DISPLAY " ".
00055       DISPLAY P. 
00060	    DISPLAY " ".
00100	100. DISPLAY "A,B? " WITH NO ADVANCING.
00110       ACCEPT A,B. 
00210       ADD A,B GIVING X1 ROUNDED. 
00220	    SUBTRACT B FROM A GIVING X2 ROUNDED.
00230	    MULTIPLY A BY B GIVING X3 ROUNDED.
00240	    DIVIDE A BY B GIVING X4 ROUNDED ON SIZE ERROR GO TO 400.
00250       COMPUTE X5 ROUNDED =A^B ON SIZE ERROR GO TO 400. 
00260	    IF A>B GO TO 300.
00270	    MOVE A TO X6.
00280	    MOVE B TO X7.
00290	    GO TO 320.
00300	300. MOVE B TO X6.
00310	    MOVE A TO X7.
00320	320. COMPUTE X8 ROUNDED = (A*A + B*B)^0.5.
00330       DISPLAY R. 
00340	    DISPLAY " ".
00350       GO TO 100. 
00400	400. DISPLAY "ERROR". DISPLAY " ". GO TO 100.
00999	999. STOP RUN.