Change Bit Status using XCL (CHGBITSXCL)
The Change Bit Status using XCL (CHGBITSXCL) command changes the status of one or more bits in a byte value.
This function is also available with command CHGBITSTS in library VC2XCL. Any use of this alternative command name should be library qualified in case the i operating system were to use this command name in a future release.
| Keyword | Description | Choices | Notes |
| BYTE |
Byte to set |
Character value |
Required, Positional 1 |
| FIRST |
Status of first bit |
*OFF, *ON, 0, 1 |
Optional, Positional 2 |
| SECOND |
Status of second bit |
*OFF, *ON, 0, 1 |
Optional |
| THIRD |
Status of third bit |
*OFF, *ON, 0, 1 |
Optional |
| FOURTH |
Status of fourth bit |
*OFF, *ON, 0, 1 |
Optional |
| FIFTH |
Status of fifth bit |
*OFF, *ON, 0, 1 |
Optional |
| SIXTH |
Status of sixth bit |
*OFF, *ON, 0, 1 |
Optional |
| SEVENTH |
Status of seventh bit |
*OFF, *ON, 0, 1 |
Optional |
| EIGHTH |
Status of eighth bit |
*OFF, *ON, 0, 1 |
Optional |
Byte to set (BYTE)
Specifies byte of data to be changed.
This is a required parameter.
- character-value
- Specify the name of the CL variable that is to be changed.
Status of first bit (FIRST)
Specifies how the corresponding bit of the byte identified by the BYTE parameter should be set. If this parameter is not specified the corresponding bit is left in its current status.
- *OFF
- The corresponding bit is to be turned off.
- *ON
- The corresponding bit is to be turned on.
- 0
- The corresponding bit is to be turned off.
- 1
- The corresponding bit is to be turned on.
Status of second bit (SECOND)
Specifies how the corresponding bit of the byte identified by the BYTE parameter should be set. If this parameter is not specified the corresponding bit is left in its current status.
- *OFF
- The corresponding bit is to be turned off.
- *ON
- The corresponding bit is to be turned on.
- 0
- The corresponding bit is to be turned off.
- 1
- The corresponding bit is to be turned on.
Status of third bit (THIRD)
Specifies how the corresponding bit of the byte identified by the BYTE parameter should be set. If this parameter is not specified the corresponding bit is left in its current status.
- *OFF
- The corresponding bit is to be turned off.
- *ON
- The corresponding bit is to be turned on.
- 0
- The corresponding bit is to be turned off.
- 1
- The corresponding bit is to be turned on.
Status of fourth bit (FOURTH)
Specifies how the corresponding bit of the byte identified by the BYTE parameter should be set. If this parameter is not specified the corresponding bit is left in its current status.
- *OFF
- The corresponding bit is to be turned off.
- *ON
- The corresponding bit is to be turned on.
- 0
- The corresponding bit is to be turned off.
- 1
- The corresponding bit is to be turned on.
Status of fifth bit (FIFTH)
Specifies how the corresponding bit of the byte identified by the BYTE parameter should be set. If this parameter is not specified the corresponding bit is left in its current status.
- *OFF
- The corresponding bit is to be turned off.
- *ON
- The corresponding bit is to be turned on.
- 0
- The corresponding bit is to be turned off.
- 1
- The corresponding bit is to be turned on.
Status of sixth bit (SIXTH)
Specifies how the corresponding bit of the byte identified by the BYTE parameter should be set. If this parameter is not specified the corresponding bit is left in its current status.
- *OFF
- The corresponding bit is to be turned off.
- *ON
- The corresponding bit is to be turned on.
- 0
- The corresponding bit is to be turned off.
- 1
- The corresponding bit is to be turned on.
Status of seventh bit (SEVENTH)
Specifies how the corresponding bit of the byte identified by the BYTE parameter should be set. If this parameter is not specified the corresponding bit is left in its current status.
- *OFF
- The corresponding bit is to be turned off.
- *ON
- The corresponding bit is to be turned on.
- 0
- The corresponding bit is to be turned off.
- 1
- The corresponding bit is to be turned on.
Status of eighth bit (EIGHTH)
Specifies how the corresponding bit of the byte identified by the BYTE parameter should be set. If this parameter is not specified the corresponding bit is left in its current status.
- *OFF
- The corresponding bit is to be turned off.
- *ON
- The corresponding bit is to be turned on.
- 0
- The corresponding bit is to be turned off.
- 1
- The corresponding bit is to be turned on.
Examples for CHGBITSXCL
Example 1: Setting On One Bit
Dcl Var(&Char) Type(*Char) Len(1) Value(X'08')
ChgBitSXCL Byte(&Char) First(*On)
This example sets on the first bit of CL variable &Char. Prior to running the CHGBITSXCL command the value of &Char is x'08' or b'00001000'. After running CHGBITSXCL the value of &Char is x'88' or b'10001000'.
Example 2: Changing Multiple Bits
Dcl Var(&Char) Type(*Char) Len(1) Value(X'03')
ChgBitSXCL Byte(&Char) Second(*on) Eighth(*Off)
This example sets on the second bit and sets off the eighth bit of CL variable &Char. Prior to running the CHGBITSXCL command the value of &Char is x'03' or b'00000011'. After running CHGBITSXCL the value of &Char is x'42' or b'01000010'.
Error messages for CHGBITSXCL
*ESCAPE Messages
- XCL9002
- Function did not complete. See previously listed messages related to possible user errors.
- XCL9003
- Function did not complete. See previously listed messages for possible cause.
- XCL9004
- Function did not complete. See previously listed messages for possible cause.
|