• State Suggested Answer
  • Date
  • Date 1 Jan 2019 11:53
  • Replies 5 replies
  • Answers 1 answer
  • Subscribers 260 subscribers
  • Views 126 views
Product Documentation

Identify Field is Hidden field

Hi There, 

Can you provide c# code sample to identify the Field is hidden or password field.

 

Right now I am using following code to get FieldName

public string CopyFieldToString(UInt32 rc)
{
UInt32 ReceivedCode = rc;
byte[] databyte = new byte[20];
UInt16 f = (UInt16)FunctionCodes.CopyFieldToString; //Function 34
UInt32 l = 20;
HLLAPIWrapperMethod(out f, databyte, out l, out ReceivedCode);  
//TODO if REceivedCode is zero then its success otherwise failed
string txt = string.Empty;
for (int i = 0; i < databyte.Length; i++)
{
txt += Convert.ToString((char)databyte[i]);
}
return txt;
}

With this i want to know if its password field stop capturing it.

 

  • Hi Raman,

    I think you need to use Function 14 to quesry the field attribute and then check the bit to see if the field in a NonDisplay field.

    Tom
  • In reply to TomFitz:

    Hello TomFitz,

    Once again thank you for the reply.

    Can you provide c# code sample for the same.
    I am unable to detect the field.
    For one field i am getting Value 223.
    How to interpret it decide that it is hidden field.
  • In reply to raman:

    Hi,

    From IBM documentation here www.ibm.com/.../emulator_programming08.htm

    You need to check for 0b11000 for a non Display attribute, pay attention that the leading 0b will make the number a binary literal number.

    int fieldAttribute = 223;
    if((fieldAttribute & 0b11000) != 0) {
    // We are dealing with nonDisplay field
    }

    Thanks
    Adi

  • In reply to AdiA:

    Hi Adi

    Thank you for the reply.
    I did one thing I captured Field Attribute of all the field.
    I observed that for Password and new Password I am getting integer value 205.
    So I am taking decision that this is Hidden field.

    int fieldAttribute = GetFieldAttribute(rc,CurrentField);

    if((fieldAttribute == 205) {
    //Hidden field
    }

    Please correct me if I am doing something wrong.
  • In reply to raman:

    Hi Raman,

     

    First I'm sorry but it looks like I did a mistake regarding the order of the bits, from this line "The bit positions are in IBM format with bit 0 as the left most bit in the byte." I see that my previous response assume 0 is the right most position...

    I wouldn't use 205 as indication to hidden field , as you saw before you can get 233 as hidden field as well or any other number

    In the link I sent you to IBM protocol specification you can see the following table:

    for 3270

    Bit Position Meaning
    0-1 Both = 1, field attribute byte
    2 Unprotected/protected

    0 = Unprotected data field

    1 = Protected field

    3 A/N

    0 = Alphanumeric data

    1 = Numeric data only

    4-5 I/SPD

    00 = Normal intensity, pen not detectable

    01 = Normal intensity, pen detectable

    10 = High intensity, pen detectable

    11 = Nondisplay, pen not detectable

    6 Reserved
    7 MDT

    0 = Field has not been modified

    1 = Field has been modified

    in you example

    205 is equal to 11001101 in binary

    so to check the masking data will give us the following:

    11001101 - Field Attribute

     

    11001101 - Unprotected data field

    11001101  - Alphanumeric data

    11001101 - 00 = Nondisplay, pen not detectable, pen not detectable

    11001101 - Reserve , not used

    11001101 - Field has been modified

     

    if you are using 5250:

    Bit Position Meaning
    0 Field attribute flag

    0 = Nonfield attribute flag

    1 = Field attribute flag

    1 Visibility

    0 = Nondisplay

    1 = Display

    2 Unprotected/protected

    0 = Unprotected data field

    1 = Protected field

    3 Intensity

    0 = Normal intensity

    1 = High intensity

    4-6 Field type

    000 = Alphanumeric data: All characters are available

    001 = Alphabet only: Uppercase and lowercase, comma, period, hyphen, blank, or Dup key are available

    010 = Numeric shift: Automatic shift for number

    011 = Numeric data only: 0-9, comma, period, plus, minus, blank, or Dup key are available

    101 = Numeric data only: 0-9, or Dup key are available

    110 = Magnetic stripe reading device data only

    111 = Signed-numeric data: 0-9, plus, minus, or Dup key are available

    7 MDT

    0 = Field has not been modified

    1 = Field has been modified

     

    205 is equal to 11001101 in binary

    11001101 - Nonfield attribute flag

    11001101 - Display

    11001101  - UnProtected field

    11001101 - Normal intensity

    11001101 - Magnetic stripe reading device data only

    11001101  Field has been modified

     

    In order to check for hidden field you need to check for

    3270: 11 in the 4-5 bit offset  so the check is 0B00001100 or just 12 or 0xC --> if (fieldAttrib &  0B00001100 ) == 0B00001100 

    5250: 0 in second bit 0b01000000 --> if (fieldAttrib &  0b01000000 ) == 0 

    Hope this will help this time and sorry for the mistake

    Adi