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
but the above code doesn’t work fine as the hex of both the fields are different and I am not able understand why?
Could any one try to help me with this?
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)
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’
0100 WRITE ‘RQUAL’
The result was ‘EQUAL’; Sorry if I don’t really follow you
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.
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' -
1 #B (A32) INIT<H'E2C1D9F0F0F0F2C160C9D5D7E4E34040' -
PRINT '=' #A (EM=H(32)) / '=' #B (EM=H(32))
IF #A NE #B
PRINT 'NOT EQUAL'
The content in the variable in PRR-STRUCTURE-NAME and PRR-FIELD-NAME are same but the hex code are different.
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
2 #A (A1)
2 #B (A1)
The group name #GROUPXCVFRTGHZUJKILOPLKJUHGFR-W is shown both in PRR-STRUCTURE-NAME and PRR-FIELD-NAME.
The API returns:
In PRR-STRUCTURE-NAME the last character W is missing. The last character on position 32 is H’00’.
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.