Release the NEW Power of CL

Release the NEW Power of CL

Name:

Email:

Programming Services

Do you need a program written?

Bruce Vining Services can provide highly experienced IBM i developers to supplement your staff with short term contracts. We don't do general ledger but if you are looking for custom solutions involving system functions such as database, communications, security, encryption, print, and work management you will find your answers at Bruce Vining Services.

Change Bit Status using XCL PDF Print E-mail

Change Bit Status using XCL (CHGBITSXCL)

Where allowed to run:
  • Batch program (*BPGM)
  • Interactive program (*IPGM)
Threadsafe: Yes
Parameters
Examples
Error messages

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.

Top

Parameters

KeywordDescriptionChoicesNotes
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
Top

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.
Top

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.
Top

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.
Top

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.
Top

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.
Top

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.
Top

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.
Top

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.
Top

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.
Top

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'.

Top

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.
Top
 
Joomla 1.5 Templates by Joomlashack