Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
IDENTIFICATION DIVISION.
PROGRAM-ID. DEMOPGM.
DATE-COMPILED.
****************************************************************
* THIS PROGRAM DEMONSTRATES HOW TO USE LANGUAGE ENVIRONMENT *
* CALLABLE SERVICES TO DETERMINE THE SETTING OF A BIT IN *
* A BINARY FULLWORD. *
****************************************************************
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SOURCE-COMPUTER. IBM-370.
OBJECT-COMPUTER. IBM-370.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
DATA DIVISION.
FILE SECTION.
WORKING-STORAGE SECTION.
01 FEEDBACK-CODE.
05 FC-SEVERITY PIC S9(4) BINARY VALUE +0.
05 FC-MESSAGE PIC S9(4) BINARY VALUE +0.
05 FILLER PIC X(08).
01 WS-WORK-FIELDS.
05 INPUT-BINARY-FIELD PIC S9(9) BINARY VALUE +0.
05 BIT-POINTER PIC S9(9) BINARY VALUE +0.
05 RESULT-FIELD PIC S9(9) BINARY VALUE +0.
PROCEDURE DIVISION.
*****************************************************************
* DETERMINE THE VALUE IN A SPECIFIC BIT IN A FULLWORD. *
* *
* - 'BIT-POINTER'. MOVE A VALUE TO THIS FIELD TO INDICATE *
* WHICH BIT YOU WANT TO TEST. BIT '0' IS THE LOW-ORDER *
* BIT AND '31' IS THE HIGH-ORDER. *
* - 'RESULT-FIELD'. CONTAINS A VALUE OF '0' OR '1', INDICATING *
* THE VALUE OF THE BIT TO WHICH BIT-POINTER IS POINTING. *
* *
*****************************************************************
*****************************************************************
* THE FOLLOWING LOGIC DETERMINES THE SETTING OF BIT 24 *
* IN FIELD 'INPUT-BINARY-FIELD'. *
*****************************************************************
MOVE +24 TO BIT-POINTER.
MOVE +0 TO RESULT-FIELD.
CALL 'CEESITST' USING INPUT-BINARY-FIELD,
BIT-POINTER,
FEEDBACK-CODE,
RESULT-FIELD.
IF FC-SEVERITY = +0
DISPLAY 'VALUE OF BIT ' BIT-POINTER ' IS ' RESULT-FIELD
ELSE
DISPLAY 'BAD RETURN FROM CEESITST '
DISPLAY 'FEEDBACK SEVERITY = ' FC-SEVERITY
DISPLAY 'FEEDBACK MESSAGE = ' FC-MESSAGE.
GOBACK.
05 WRK-COMPOPT-BITS PIC X(08).
05 WRK-COMPOPTS-NUM REDEFINES
WRK-COMPOPT-BITS PIC S9(10) COMP.
05 FILLER REDEFINES
WRK-COMPOPT-BITS.
10 WRK-1ST-OPT-BYTE PIC X(01).
10 FILLER PIC X(07).
.
.
.
.
(p1) MOVE ZEROS TO WRK-COMPOPT-BITS
(p2) MOVE YOUR-6BYTE-FLD TO WRK-COMPOPT-BITS(1:6)
(p3) PERFORM 37 TIMES
(p4) IF WRK-1ST-OPT-BYTE > X'79'
(p5) PERFORM 1000-BIT-IS-ON-STUFF
(p6) ELSE
(p7) PERFORM 2000-BIT-IS-OFF-STUFF
(p8) END-IF
(p9) COMPUTE WRK-COMPOPTS-NUM = WRK-COMPOPTS-NUM * 2
(pa) END-PERFORM