IT is a discipline which rewards attention to detail. I took your code as you posted it and ran it through the compiler -- after defining a value clause for WS-NUM3. The results are:
000013 01 WS-NUM1 PIC 9(02) VALUE ZERO
000014 01 WS-NUM2 PIC 9(02) VALUE ZERO
==000014==> IGYDS1082-E A period was required. A period was assumed before "01
000015 01 WS-NUM3 PIC 9(10) VALUE ZERO.
==000015==> IGYDS1082-E A period was required. A period was assumed before "01
000016 PROCEDURE DIVISION
000017 PERFORM VARYING WS-NUM1 1 BY 1 UNTIL WS-NUM1 < = 3.
==000017==> IGYPS2145-E A period was required. A period was assumed before "PE
==000017==> IGYPS0088-S The "PERFORM" statement was invalid. Expected "FROM",
The statement was discarded.
==000017==> IGYPS2112-E The "PERFORM" statement did not have a matching scope t
scope terminator was assumed on line 17. The execution
be correct.
000018 PERFORM VARYING WS-NUM2 1 BY 1 UNTIL WS-NUM2 < = WS
==000018==> IGYPS0088-S The "PERFORM" statement was invalid. Expected "FROM",
The statement was discarded.
==000018==> IGYPS2112-E The "PERFORM" statement did not have a matching scope t
scope terminator was assumed on line 18. The execution
be correct.
000019 COMPUTE WS-NUM3=WS-NUM1*WS-NUM2.
==000019==> IGYPS0001-W A blank was missing before character "=" in column 27.
assumed.
==000019==> IGYPS0001-W A blank was missing before character "W" in column 28.
assumed.
==000019==> IGYPS0001-W A blank was missing before character "*" in column 35.
assumed.
==000019==> IGYPS0001-W A blank was missing before character "W" in column 36.
1PP 5655-G53 IBM Enterprise COBOL for z/OS 3.4.1 MF0147 Date 0
LineID PL SL ----+-*A-1-B--+----2----+----3----+----4----+----5----+----6--
0 assumed.
000020 DISPLAY ' ' WS-NUM3 WITH NO ADVANCING.
000021 END-PERFORM.
==000021==> IGYPS2113-E The explicit scope terminator "END-PERFORM" was found w
verb. The scope terminator was discarded.
000022 END-PERFORM.
==000022==> IGYPS2113-E The explicit scope terminator "END-PERFORM" was found w
verb. The scope terminator was discarded.
13 errors in 3 variable definitions and 6 lines of code is quite a ratio! I recommend you take a course to learn the syntax of COBOL before attempting to post questions on this -- or any -- forum. I changed it to code that will actually compile (and added some indentation as well):
01 WS-NUM1 PIC 9(02) VALUE ZERO.
01 WS-NUM2 PIC 9(02) VALUE ZERO.
01 WS-NUM3 PIC 9(10) VALUE ZERO.
PROCEDURE DIVISION.
PERFORM VARYING WS-NUM1 FROM 1 BY 1
UNTIL WS-NUM1 <= 3
PERFORM VARYING WS-NUM2 FROM 1 BY 1
UNTIL WS-NUM2 <= WS-NUM1
COMPUTE WS-NUM3 = WS-NUM1 * WS-NUM2
DISPLAY ' ' WS-NUM3 WITH NO ADVANCING
END-PERFORM
END-PERFORM.
Issues:
1. You will get no output from this program. PERFORM ... UNTIL defaults to WITH TEST BEFORE per section 6.2.27.4 of the COBOL
Language Reference manual. Hence, the first PERFORM test is done, and WS-NUM1 has a value <= 3 (zero is less than three in COBOL) so none of the code in the outer PERFORM loop is executed. So the only thing the program has to do is exit -- which it does.
2. Your inner PERFORM loop has the same issue.
Once you get past these issues, you should be able to get some output to start figuring out if your algorithm is correct or not.