Site icon LANSA

The Developers’ Corner: Bit shift, IBM i system variables via SQL and busy cursor

New feature in Visual LANSA EPC150050: BitShiftLeft and BitShiftRight

Bit shift is a bitwise operation where the order of several bits is moved, either to the left or right, to efficiently perform a mathematical operation. Bit shifts help with optimization in low-level programming because they require fewer calculations for the CPU than conventional math. Bit shifting operations may be declared explicitly by the programmer, or automatically by the compiler if it can identify that such an optimization is possible.
For example, consider the integer 23, represented with eight bits:
00010111
If we shift all the bits left one place, discard the leftmost bit, and insert a zero on the right, the result is the binary representation of 46:
00101110
This action is effectively the same as multiplying the number by two.
These intrinsics are available on LANSA Integer fields.

Show all IBM i System Variables via SQL script

The IBM i Access Client Solutions Windows tool has a Run SQL Script Database option.

If you run select * from qsys2.system_value_info you will get the results of all IBM i system variables in one overview:

How to show the busy cursor

A straightforward way to provide feedback if a process takes a while to complete is to show the Windows busy cursor. Event handling routines have a com_cursor() parameter which shows the hourglass cursor immediately, or after a delay of 1, 2, or 4 seconds.

If you test the source below in a Form, you can see how it behaves:

Com_Cursor parameter values are:

Exit mobile version