## Identifying Each Field/Field Attribute From Attachmate Extra! Screen

## Identifying Each Field/Field Attribute From Attachmate Extra! Screen

(OP)

Goal: Identify all field/field attributes on any given Extra! screen and place into Excel.

Problem: I want to be able to distinguish where every field starts and ends and then identify what fields are protected vs unprotected etc... I can get the field attributes with the FieldAttribute property but I cannot for the life of me find anywhere on the internet that provides a way to decipher what each value means. The Extra! Help file states...

/For a complete discussion of how to interpret 3270 and 5250 field attribute values, see the "EXTRA! Developer Series API SDK – Programmer'

s Guide"/

Problem is, I don't know that this guide actually exists as I have spent hours trying to find something online. Is this actually available?

Here is my current code to pull the attributes...

This gives me 10 different values for attributes...

192

200

208

217

224

225

240

248

249

252

No idea what to do with them from there. Any ideas?

Problem: I want to be able to distinguish where every field starts and ends and then identify what fields are protected vs unprotected etc... I can get the field attributes with the FieldAttribute property but I cannot for the life of me find anywhere on the internet that provides a way to decipher what each value means. The Extra! Help file states...

/For a complete discussion of how to interpret 3270 and 5250 field attribute values, see the "EXTRA! Developer Series API SDK – Programmer'

s Guide"/

Problem is, I don't know that this guide actually exists as I have spent hours trying to find something online. Is this actually available?

Here is my current code to pull the attributes...

#### CODE

Sub GetFieldAtts()

ActivateAttachmate '*Custom Function In Excel

Application.ScreenUpdating = False

For i = 1 To MyScreen.Rows

For a = 1 To MyScreen.Cols

vAtt = MyScreen.FieldAttribute(i, a)

Worksheets("Test").Cells(i, a).Value = vAtt

Next

Next

Application.ScreenUpdating = True

End Sub

ActivateAttachmate '*Custom Function In Excel

Application.ScreenUpdating = False

For i = 1 To MyScreen.Rows

For a = 1 To MyScreen.Cols

vAtt = MyScreen.FieldAttribute(i, a)

Worksheets("Test").Cells(i, a).Value = vAtt

Next

Next

Application.ScreenUpdating = True

End Sub

This gives me 10 different values for attributes...

192

200

208

217

224

225

240

248

249

252

No idea what to do with them from there. Any ideas?

## RE: Identifying Each Field/Field Attribute From Attachmate Extra! Screen

Mine is the 3270 Terminal but try and see if any of the tables somehow fit

http://p

## RE: Identifying Each Field/Field Attribute From Attachmate Extra! Screen

I routinely use a table like this to describe the screens I scrape...

ScrNam FIELD FR TR CL LN TYP

AP412431 ScrName 1 1 3 8 CHAR

AP412431 ScrDesc 1 1 11 50 CHAR

AP412431 SysDte 1 1 61 8 CHAR

AP412431 SysTme 1 1 70 8 CHAR

AP412431 Page 2 2 75 4 NUM

where

ScrNam Screen Name

FIELD Field Name

FR Field Data FROM ROW

TR Field Data THRU ROW for multi-row fields

CL Field Data COLUMN

LN Field LENGTH

TYP Field TYPE

Then I use a series of Functions, using this table to return a value from the screen or place a value on the screen.

Skip,

_{Just traded in my old subtlety...for a NUANCE!}## RE: Identifying Each Field/Field Attribute From Attachmate Extra! Screen

Sub Main

Dim Modified$, Numeric$, Protected$, Display$

iValue = 252

If ivalue And 1 Then

Modified$ = "modified"

Else

Modified$ = "unmodified"

End If

If ivalue And 16 Then

Numeric$ = "numeric"

Else

Numeric$ = "alpha-numeric"

End If

If ivalue And 32 Then

Protected$ = "protected"

Else

Protected$ = "unprotected"

End If

If (ivalue And 4) Then

If (ivalue And 8) Then

Display$ = "password field"

Else

Display$ = "not a password field"

End If

Else

Display$ = "not a password field"

End If

Msgbox iValue + "; " + Modified$ + "; " + Numeric$ + "; " + Protected$ + "; " + Display$

End Sub

As you can see.. I just plugged in one of your values, but you can easily build an array and run the entire array through the statements. Then you can have the information posted to an excel spreadsheet or to a text document for easy reference.

Hope this helps.

Also, I got that bit of information from the OLE Help file for Extra. I can help you find that if needed. :)

## RE: Identifying Each Field/Field Attribute From Attachmate Extra! Screen

Basically, the above if statements are used to check and see if a bit is turned on or off in a certain position. I am not sure how familiar you are with binary number representation but, basically, each of the values you listed are the numeric representation of an 8 bit, binary field. If a bit is turned on or off it dictates the attributes of that field.

The bits are numbered from right to left as 0 through 7. So.. looks something like this..

| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |

If the bit in position 0 is turned ON.. meaning, it's a 1.. modified field. If the bit in position 4 is turned on then it's a numeric field only. On to the confusing part.

A number is represented in Binary by the bits being turned on or off and then adding up the represented values. For this particular case, since we are dealing with 8 bits, the numbers can never go higher than 255. Why?? Well lets look at the numerical representation of what those positions mean.

Here's the numerical representations of those position.

| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |

To get any number between 0 and 255 you simply add up the positions in which the bits are turned on. So, if the bits are turned on in positions 0, 4, and 6, the numerical value would be 1 + 16 + 64 = 81.

The numbers you posted can now be broken down. As stated in the link from Lakare, positions 7 and 6 are ALWAYS turned on, meaning those bits are always turned on. This means that 192 (128 + 64) is the lowest number you will ever see. As a result.. a bit of easy math will help you determine which other bits are turned on.

Lets do one. 208. Well, subtract 192, or positions 7 and 6 (128 and 64) from 208. What's left is a 16. Well.. position 4 is 16. When doing this math, you MUST subtract the largest number possible first. Meaning, you start subtracting from left to righ. Subtract 128, if anything is left then subtract 64, if anything is left then subtract 32, etc.. etc.. If you can't subtract that number, the move on to the next one. If that number can be subtracted then the bit is turned on. In the number 208 we can subtract 128, then 64, NOT 32, then 16. This means bits representing 128, 64, and 16 are turned on. Bit 32 is NOT on.

So according to that chart, if position 4 is turned on and no other positions are turned on, then it should be an unmodified, unprotected, numeric only, non-password field.

The code checks this for you by comparing the return number and a binary literal together to determine if the number you have has a bit turned on it the correct binary position. So for the number 208, the 4th position bit is turned on.. (in binary it would look like this 11010000 ; remember that right most bit is in position 0, not position 1) well.. when the If statement rolls around it looks at the binary comparison if 1101000 AND 0001000 to see if that statement is true. Since both numbers have a bit turned on in position 4, the statement is considered true. What would it do if the number was 209? the statement would also be true. The binary literal would be 1101001. Since the 4th position bit is still turned on, it would evaluate as true. If you look at the code above, then that number would evaluate true in 2 places. For position 4 and position 0.. ie.. 16 and 1.

I don't know if this helps but I thought an explanation of how the evaluation is working would be helpful.

## RE: Identifying Each Field/Field Attribute From Attachmate Extra! Screen

## RE: Identifying Each Field/Field Attribute From Attachmate Extra! Screen

Taking the next step...I need to know where defined fields begin and end as field attributes alone won't provide this much detail (that I have been able to discover at least).

Example: If I have the following on the screen...

LOC 98 CYC 76 REG 36

All of those values appear on screen as Protected/Alpha-Numeric fields and hold a field attribute value of 240. The problem is, 98, 76 and 36 are dynamic fields in that those values can change, wherein the alpha bits are simply static field names so to speak.

I need to be able to distinguish between what is a 'label' and what is a corresponding value. Does that make sense?

Try this...go to Options -> Settings -> Display -> Attributes and then select 'Show field attribute value'.

This will give you an idea of what I'm looking at.

These values appear to indicate the separation/beginning/ending of fields. At the beginning of each field is a stacked two bit alpha numeric code. So if you imagine a quartered square, the bits show up in the top left and lower right quadrants. Sort of like this...(though the two bits are on the same row)

F LOC E 98 F CYC E 76 F REG F 36

0 0 0 0 0 0

The first bit appears to always be Alpha (C,D,E,F).

The second bit is alpha-numerica (0,1,8,9,C).

Any thoughts/insight on the meaning and how I can access that information?

## RE: Identifying Each Field/Field Attribute From Attachmate Extra! Screen

Binary 1111000 = 1*2^7 + 1*2^6 + 1*2^5 + 1*2^4 + 0*2^3 + 0*2^2 + 0*2^1 + 0*2^0

Decimal 240 = 2*10^2 + 4*10^1 + 0*10^0

Hexidecimal F0 = 15*16^1 + 0*16^0

The numbers are three vays to describe numbers, all which are used in computer science.

Hope it helps.

## RE: Identifying Each Field/Field Attribute From Attachmate Extra! Screen

0|1|2|3|4|5|6|7|8|9|A(10)|B(11)|C(12)|D(13)|E(14)|F(15)

## RE: Identifying Each Field/Field Attribute From Attachmate Extra! Screen