Data update
This commit is contained in:
parent
61b93a2cd1
commit
5af6d93694
858 changed files with 20572 additions and 2082 deletions
|
|
@ -5,10 +5,9 @@
|
|||
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) COMP.
|
||||
|
||||
01 result-disp REDEFINES result
|
||||
PIC S9(9) USAGE COMPUTATIONAL.
|
||||
LINKAGE SECTION.
|
||||
01 a-int USAGE BINARY-LONG.
|
||||
01 b-int USAGE BINARY-LONG.
|
||||
|
|
@ -29,7 +28,28 @@
|
|||
COMPUTE result = a B-XOR b
|
||||
DISPLAY "a exclusive-or b is " result-disp
|
||||
|
||||
*> COBOL does not have shift or rotation operators.
|
||||
*> More complex operations can be constructed from these.
|
||||
|
||||
GOBACK
|
||||
.
|
||||
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.
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
DATA DIVISION.
|
||||
LOCAL-STORAGE SECTION.
|
||||
01 result USAGE BINARY-LONG.
|
||||
|
||||
78 arg-len VALUE LENGTH OF result.
|
||||
|
||||
LINKAGE SECTION.
|
||||
|
|
@ -37,5 +36,6 @@
|
|||
CALL "CBL_IMP" USING a, result, VALUE arg-len
|
||||
DISPLAY "Logical implication of a and b is " result
|
||||
|
||||
GOBACK
|
||||
.
|
||||
GOBACK.
|
||||
|
||||
END PROGRAM mf-bitwise-ops.
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@ extension testOp
|
|||
{
|
||||
bitwiseTest(y)
|
||||
{
|
||||
console.printLine(self," and ",y," = ",self.and(y));
|
||||
console.printLine(self," or ",y," = ",self.or(y));
|
||||
console.printLine(self," xor ",y," = ",self.xor(y));
|
||||
console.printLine("not ",self," = ",self.Inverted);
|
||||
console.printLine(self," and ",y," = ",self & y);
|
||||
console.printLine(self," or ",y," = ",self | y);
|
||||
console.printLine(self," xor ",y," = ",self ^ y);
|
||||
console.printLine("not ",self," = ",self.BInverted);
|
||||
console.printLine(self," shr ",y," = ",self.shiftRight(y));
|
||||
console.printLine(self," shl ",y," = ",self.shiftLeft(y));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue