Data update

This commit is contained in:
Ingy döt Net 2026-02-01 16:33:20 -08:00
parent 5150844a7d
commit 4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions

View file

@ -1,55 +0,0 @@
IDENTIFICATION DIVISION.
PROGRAM-ID. bitwise-ops.
DATA DIVISION.
LOCAL-STORAGE SECTION.
01 a PIC 1(32) USAGE BIT.
01 b PIC 1(32) USAGE BIT.
01 result PIC 1(32) USAGE BIT.
01 result-disp REDEFINES result
PIC S9(9) USAGE COMPUTATIONAL.
LINKAGE SECTION.
01 a-int USAGE BINARY-LONG.
01 b-int USAGE BINARY-LONG.
PROCEDURE DIVISION USING a-int, b-int.
MOVE FUNCTION BOOLEAN-OF-INTEGER(a-int, 32) TO a
MOVE FUNCTION BOOLEAN-OF-INTEGER(b-int, 32) TO b
COMPUTE result = a B-AND b
DISPLAY "a and b is " result-disp
COMPUTE result = a B-OR b
DISPLAY "a or b is " result-disp
COMPUTE result = B-NOT a
DISPLAY "Not a is " result-disp
COMPUTE result = a B-XOR b
DISPLAY "a exclusive-or b is " result-disp
*> More complex operations can be constructed from these.
COMPUTE result = B-NOT (a B-XOR b)
DISPLAY "Logical equivalence of a and b is " result-disp
COMPUTE result = (B-NOT a) B-AND b
DISPLAY "Logical implication of a and b is " result-disp
*> Shift and rotation operators were only added in COBOL 2023.
COMPUTE result = a B-SHIFT-L b
DISPLAY "a shifted left by b is " result-disp
COMPUTE result = b B-SHIFT-R a
DISPLAY "b shifted right by a is " result-disp
COMPUTE result = a B-SHIFT-LC b
DISPLAY "a rotated left by b is " result-disp
COMPUTE result = b B-SHIFT-RC a
DISPLAY "b rotated right by a is " result-disp
GOBACK.
END PROGRAM bitwise-ops.

View file

@ -1,41 +0,0 @@
IDENTIFICATION DIVISION.
PROGRAM-ID. mf-bitwise-ops.
DATA DIVISION.
LOCAL-STORAGE SECTION.
01 result USAGE BINARY-LONG.
78 arg-len VALUE LENGTH OF result.
LINKAGE SECTION.
01 a USAGE BINARY-LONG.
01 b USAGE BINARY-LONG.
PROCEDURE DIVISION USING a, b.
main-line.
MOVE b TO result
CALL "CBL_AND" USING a, result, VALUE arg-len
DISPLAY "a and b is " result
MOVE b TO result
CALL "CBL_OR" USING a, result, VALUE arg-len
DISPLAY "a or b is " result
MOVE a TO result
CALL "CBL_NOT" USING result, VALUE arg-len
DISPLAY "Not a is " result
MOVE b TO result
CALL "CBL_XOR" USING a, result, VALUE arg-len
DISPLAY "a exclusive-or b is " result
MOVE b TO result
CALL "CBL_EQ" USING a, result, VALUE arg-len
DISPLAY "Logical equivalence of a and b is " result
MOVE b TO result
CALL "CBL_IMP" USING a, result, VALUE arg-len
DISPLAY "Logical implication of a and b is " result
GOBACK.
END PROGRAM mf-bitwise-ops.