summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcd.cob8
1 files changed, 5 insertions, 3 deletions
diff --git a/gcd.cob b/gcd.cob
index b6ce0db..44a60f9 100644
--- a/gcd.cob
+++ b/gcd.cob
@@ -10,8 +10,9 @@
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WS-COUNT PIC 9(20).
- 01 WS-GCD PIC Z(20).
+ 01 WS-GCD PIC 9(20).
01 WS-NUM PIC 9(20).
+ 01 WS-OUT PIC Z(20).
PROCEDURE DIVISION.
ACCEPT WS-COUNT FROM ARGUMENT-NUMBER.
IF WS-COUNT = 0 STOP RUN.
@@ -21,7 +22,8 @@
CALL 'GCD2' USING WS-GCD, WS-NUM
SUBTRACT 1 FROM WS-COUNT
END-PERFORM.
- DISPLAY FUNCTION TRIM (WS-GCD LEADING).
+ MOVE WS-GCD TO WS-OUT.
+ DISPLAY FUNCTION TRIM (WS-OUT LEADING).
END PROGRAM GCD.
IDENTIFICATION DIVISION.
@@ -30,7 +32,7 @@
WORKING-STORAGE SECTION.
01 WS-C PIC 9(20).
LINKAGE SECTION.
- 01 L-A PIC Z(20).
+ 01 L-A PIC 9(20).
01 L-B PIC 9(20).
PROCEDURE DIVISION USING L-A, L-B.
PERFORM WITH TEST BEFORE UNTIL L-B = 0