-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fae1573
commit fae181a
Showing
1 changed file
with
18 additions
and
16 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,20 @@ | ||
IDENTIFICATION DIVISION. | ||
PROGRAM-ID. IncrementProgram. | ||
identification division. | ||
program-id. count. | ||
|
||
DATA DIVISION. | ||
WORKING-STORAGE SECTION. | ||
01 i PIC 9(10) VALUE 0. | ||
01 target PIC 9(10). | ||
01 quotient PIC 9(10). | ||
01 rem PIC 9(10). | ||
data division. | ||
working-storage section. | ||
01 i pic 9(10) value 0 usage comp-5. | ||
01 target pic 9(10). | ||
01 len pic 9(10) value 1. | ||
01 or-result pic 9(10). | ||
01 result pic z(10). | ||
|
||
PROCEDURE DIVISION. | ||
ACCEPT target FROM COMMAND-LINE | ||
PERFORM UNTIL i = target | ||
ADD 1 TO i | ||
ADD 1 TO i *> should be bitwise or 1 but no bit-or in cobol :/ | ||
END-PERFORM. | ||
DISPLAY i | ||
STOP RUN. | ||
procedure division. | ||
accept target from command-line | ||
perform until i > target | ||
add 1 to i | ||
call "CBL_OR" using 1 i by value len returning or-result end-call | ||
end-perform. | ||
move i to result | ||
display result | ||
stop run. |