View previous topic :: View next topic |
Author |
Message |
nbdtrjk_1 Beginner
Joined: 14 Jun 2021 Posts: 14 Topics: 5
|
Posted: Tue Jul 22, 2025 10:26 pm Post subject: How to extract and check bit values via Easytrieve |
|
|
Hi All
I have requirement to extract the bit values via Easytrieve and do the validations as per the bit values(i tried this via REXX but business wanted it via Ezt).
I tried searching my requirement in this forum but not finding it.
E.g(Hex Representation)
if bit values is 0 then do something
if bit values is 8 then do something
if bit values is 1 then do something
can someone help me how to get this done ? |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12382 Topics: 75 Location: San Jose
|
Posted: Tue Jul 29, 2025 8:41 am Post subject: |
|
|
nbdtrjk_1 wrote: |
if bit values is 0 then do something
if bit values is 8 then do something
if bit values is 1 then do something
can someone help me how to get this done ? |
nbdtrjk_1,
Not sure if you really understand bits. A bit value is either 1 or 0, it cannot have a value of 8
if you want to check bits then use the following untested code
Code: |
DEFINE MY-FIELD S 1 B. * Define a one-byte binary field
IF MY-FIELD BITS 0:1 ON THEN * Check if the first bit (bit 0) is ON
DISPLAY 'Bit 0 is ON'.
END-IF.
|
_________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
nbdtrjk_1 Beginner
Joined: 14 Jun 2021 Posts: 14 Topics: 5
|
Posted: Tue Jul 29, 2025 11:09 pm Post subject: |
|
|
I hope this helps to understand better.
Below is my account and various account status of each accounts
Code: | ----+----1----+----2----+----3----+----4----+----5----+----6
7?\d? ? ?
000000000011FFFFFFFFFFEE882000000000008080
00000000081FFFFFFFFFF7E0414800000800000008 |
Positions 1 to 12 represent the Base Account Number. The Account status ranges from positions 20 to 4055.
At position 20, you will find the status of the first two accounts (accounts status of the first base number and second account numer(base number + 1).
At position 21, you will see the status of the next two accounts (accounts status of the third acct number(base number + 2) and fourth account numer(base number + 3). and so on.
To create a report detailing the status of each account based on the positions, you can follow a format like this:
Code: | Acct Number 8111 - Reserved status (i.e. first byte of X'81' is 8 at 20th position)
Acct Number 8112 (increment base number 8111 + 1) - Recycled status (second byte of X'81' is 1)
Acct Number 8113 (increment base number 8111 + 2) - Available status (first byte of X'24' is 2 at 21th position)
Acct Number 8114 (base number 8111 + 3) - Not Used Status (second byte of X'24' is 4)
etc till 4055th positions |
This format can be used to understand and report on the status of each account based on the designated positions in the account structure. |
|
Back to top |
|
 |
nbdtrjk_1 Beginner
Joined: 14 Jun 2021 Posts: 14 Topics: 5
|
Posted: Tue Jul 29, 2025 11:15 pm Post subject: |
|
|
Apologises, The Account status ranges from positions 26 to 4055. |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12382 Topics: 75 Location: San Jose
|
Posted: Fri Aug 01, 2025 10:30 am Post subject: |
|
|
nbdtrjk_1,
Your question has got NOTHING to do with BITS. You just need to validate a hex value. I am just showing for 1 byte , you can expand it handle all the bytes from 26 to 4055 using an array of 1 byte
try this untested code
Code: |
DEFINE STATUS-FIELD 26 1 B * Define a one-byte binary field
DEFINE HEX-STATUS W X 2 * status in hex
DEFINE ACCOUNT-STATUS W 30 A
HEX-STATUS = ' '
MOVE STATUS-FIELD TO HEX-STATUS
CASE HEX-STATUS (1 : 1)
WHEN '2'
ACCOUNT-STATUS = 'AVAILABLE'
WHEN '4'
ACCOUNT-STATUS = 'NOT USED'
WHEN '8'
ACCOUNT-STATUS = 'RECYCLED'
OTHERWISE
ACCOUNT-STATUS = 'UNKNOWN STATUS'
END-CASE
|
_________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
nbdtrjk_1 Beginner
Joined: 14 Jun 2021 Posts: 14 Topics: 5
|
Posted: Fri Aug 01, 2025 12:18 pm Post subject: |
|
|
Thanks Kolusu.
I got bit confused b/w the hex representation and Bits. Apologies for that.
DEFINE HEX-STATUS W X 2
In our shop we are using the Easytrieve IMU. Does 'X' is the valid in the above definition ? |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12382 Topics: 75 Location: San Jose
|
Posted: Sat Aug 02, 2025 8:03 am Post subject: |
|
|
nbdtrjk_1 wrote: |
DEFINE HEX-STATUS W X 2
In our shop we are using the Easytrieve IMU. Does 'X' is the valid in the above definition ? |
nbdtrjk_1,
I made it abundantly clear that my code is untested. I do not have access to Easytrieve. It takes less than 1 minute to try the code and if you get an error then please look up the manuals. _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
|
|