ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

reg TESTB

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • reg TESTB

    Hi

    Can anyone shed some light on TESTB. Wt for it is used..........


    thanks

  • #2
    Re: reg TESTB

    Testb (test bit Pattern) = compares the bits specified in factor 2 to the result field.
    There are eight bits in a byte in EBCDIC.
    Bits can be equal to either on ('1') or off ('0')

    ex. if only bits 5 and 7 are on then the byte = X'05' (hex) and
    B'00000101' and numeric value of 5

    I have attached a PDF with some examples just open and search for testb.
    Attached Files
    All my answers were extracted from the "Big Dummy's Guide to the As400"
    and I take no responsibility for any of them.

    www.code400.com

    Comment


    • #3
      Re: reg TESTB

      Hi John:

      Back in the days of old I have used the testb combined with biton/bitoff to convert upper/lower case letters.

      bit 1 on = upper case
      bit 1 off = lower case

      I have also used it to save user switches prior to calling an external program which may re-set the switches.


      C bitoff '01234567' bit
      C u1 biton '0' bit
      C u2 biton '1' bit
      etc.
      C SETOFF U1U2U3
      C SETOFF U4U5U6
      C SETOFF U7U8 C call 'otherpgm'
      C SETOFF U1U2U3
      C SETOFF U4U5U6
      C SETOFF U7U8
      C TESTB '0' BIT U1
      C TESTB '1' BIT U2
      C TESTB '2' BIT U3
      C TESTB '3' BIT U4
      C TESTB '4' BIT U5
      C TESTB '5' BIT U6
      C TESTB '6' BIT U7
      C TESTB '7' BIT U8


      I think all will agree this is really old school and I haven't seen this type of coding in recent years
      The problem with quotes on the internet is that it is hard to verify their authenticity.....Abraham Lincoln

      Comment

      Working...
      X