Hi
I am using a USR module and want to compare 2 field as per below.Both are A32 field length
IF PRR-STRUCTURE-NAME NE PRR-FIELD-NAME
do somthing
END-IF
but the above code doesn’t work fine as the hex of both the fields are different and I am not able understand why?
PRR-STRUCTURE-NAME:-
E2C1D9F0F0F0F2C160C9D5D7E4E34040
40404040404040404040404040404000
PRR-FIELD-NAME:-
E2C1D9F0F0F0F2C160C9D5D7E4E34040
40404040404040404040404040404040
Could any one try to help me with this?
Thanks
Regards
Sarabjeet Pal
HI Sarabjeet,
Unfortunately, I’m not familiar with USR module(?), but it looks like your “do something” does not execute since those 2 (A32) fields are simply EQUAL.
This is what I`ve done to test it:
0010 DEFINE DATA LOCAL
0020 1 #PRR-STRUCTURE-NAME-1 (A32)
0030 1 #PRR-STRUCTURE-NAME-2 (A32)
0040 END-DEFINE
0050 #PRR-STRUCTURE-NAME-1 := H’E2C1D9F0F0F0F2C160C9D5D7E4E34040’
0060 #PRR-STRUCTURE-NAME-2 := H’E2C1D9F0F0F0F2C160C9D5D7E4E34040’
0070 IF #PRR-STRUCTURE-NAME-1 NE #PRR-STRUCTURE-NAME-2
0080 WRITE ‘NOT RQUAL’
0090 ELSE
0100 WRITE ‘RQUAL’
0110 END-IF
0120 END
The result was ‘EQUAL’; Sorry if I don’t really follow you 
Hi Nikolay
Thanks for your time, I guess you overlooked the 2 hex code I provided,It has last 2 digit as different one has 00 and other has 40, that is the reason I think it doesn’t match.
Regards
Sarabjeet Pal
Using the following code, I get NOT EQUAL. I too am missing something. By USR module, are you referring to the SAG provided USR* subprograms in the SYSEXT library? If so, which USR are you using?
DEFINE DATA LOCAL
1 #A (A32) INIT<H'E2C1D9F0F0F0F2C160C9D5D7E4E34040' -
H'40404040404040404040404040404000'>
1 #B (A32) INIT<H'E2C1D9F0F0F0F2C160C9D5D7E4E34040' -
H'40404040404040404040404040404040'>
END-DEFINE
PRINT '=' #A (EM=H(32)) / '=' #B (EM=H(32))
IF #A NE #B
PRINT 'NOT EQUAL'
ELSE
PRINT 'EQUAL'
END-IF
END
#A: E2C1D9F0F0F0F2C160C9D5D7E4E3404040404040404040404040404040404000
#B: E2C1D9F0F0F0F2C160C9D5D7E4E3404040404040404040404040404040404040
NOT EQUAL
The content in the variable in PRR-STRUCTURE-NAME and PRR-FIELD-NAME are same but the hex code are different.
Hi Sarabjeet,
Indeed, I’ve missed the ending characters, sorry; after correction my program also tells me those strings are NOT EQUAL, which is absolutely natural to me 
However, our shop does not have USR8206N (the last one is
USR8203N Get profile parameters from the Natural parameter module).
Thus, I don`t see how I may help you in solving such a problem, sorry
In my opinion the API USR8206N (Read variable definitions from a cataloged Natural object) doesn’t return a correct value for field PRR-STRUCTURE-NAME (A32). On position 32 the returned value is always H’00’, even if the variable name is of lenght 32.
If have testet with this catalogued program:
DEFINE DATA LOCAL
1 #GROUPXCVFRTGHZUJKILOPLKJUHGFR-W
2 #A (A1)
2 #B (A1)
END-DEFINE
END
The group name #GROUPXCVFRTGHZUJKILOPLKJUHGFR-W is shown both in PRR-STRUCTURE-NAME and PRR-FIELD-NAME.
The API returns:
PRR-FIELD-NAME:
#GROUPXCVFRTGHZUJKILOPLKJUHGFR-W
7BC7D9D6E4D7E7C3E5C6D9E3C7C8E9E4D1D2C9D3D6D7D3D2D1E4C8C7C6D960E6
PRR-STRUCTURE-NAME:
#GROUPXCVFRTGHZUJKILOPLKJUHGFR-
7BC7D9D6E4D7E7C3E5C6D9E3C7C8E9E4D1D2C9D3D6D7D3D2D1E4C8C7C6D96000
In PRR-STRUCTURE-NAME the last character W is missing. The last character on position 32 is H’00’.
hth
Helmut Spichtinger
Exactly, that is reason I am using A31 character length to compare instead of 32 to serve my purpose.Thanks a lot for your time in investigating the issue.