Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

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

Status
Not open for further replies.

andyjbrommel

Programmer
Mar 2, 2012
6
US
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...

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

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?
 


I routinely use a table like this to describe the screens I scrape...
[tt]
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
[/tt]
where
[tt]
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
[/tt]
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,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Hey Andy. Try running the values through the following code. It will tell you the attributes of the fields.

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. :)

 
After doing a bit more research and testing, and with the excellent link from Lakare I have some additional information which will help you understand the previous code.

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.

 
You all are awesome as always! I will mess with the suggestions and see what I come up with.
 
Okay, so this is a HUGE step in the right direction. Many thanks for the education and assistance, you are all always so helpful.

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?
 
The numbers show is hexidecimal numbers, it is the same value. The value F0 (Hexidecimal), 240 (Decimal), 1111000 (Binary) is the same.

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.
 
Forgot to say that Hexidecimal number are representet by the 10 decimals and A,B,C,D,E,F so the numbers are

0|1|2|3|4|5|6|7|8|9|A(10)|B(11)|C(12)|D(13)|E(14)|F(15)
 
Thanks everyone! Sounds like I won't be able to truly identify the start and end of a field the way that I assumed but this has been some awesome information and very helpful. I really appreciate the help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top