![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I am doing a compare of a attribute of a file to a table the actual IF statement is IF.IM.REC<114> = UPC THEN GOTO.NEXT.ITEM The actual values are IM.REC<114> = 72288108174 UPC = 00072288108174 the IF statement acts as though it is a MATCH Any ideas? Brain totally fried today and not thinkingclearly |
#3
| |||
| |||
|
|
I am doing a compare of a attribute of a file to a table the actual IF statement is IF.IM.REC<114> = UPC THEN GOTO.NEXT.ITEM The actual values are IM.REC<114> = 72288108174 UPC = 00072288108174 the IF statement acts as though it is a MATCH Any ideas? Brain totally fried today and not thinkingclearly |
#4
| |||
| |||
|
|
I am doing a compare of a attribute of a file to a table the actual IF statement is IF.IM.REC<114> = UPC THEN GOTO.NEXT.ITEM The actual values are IM.REC<114> = 72288108174 UPC = 00072288108174 the IF statement acts as though it is a MATCH Any ideas? Brain totally fried today and not thinkingclearly |
#5
| |||
| |||
|
|
I am doing a compare of a attribute of a file to a table the actual IF statement is IF.IM.REC<114> = UPC THEN GOTO.NEXT.ITEM The actual values are IM.REC<114> = 72288108174 UPC = 00072288108174 the IF statement acts as though it is a MATCH Any ideas? Brain totally fried today and not thinkingclearly Numerically, the NUMBERS are the same! If you treat them as strings by surrounding each with quotes, the values do not equal. Test .... :CT WEAVER FOOFOO FOOFOO 001 REC114 = "72288108174" 002 UPC = "00072288108174" 003 IF REC114 = UPC THEN PRINT "SAME" ELSE PRINT "NOT.SAME" :FOOFOO NOT.SAME : Note: Without the surrounding quotes, it comes up SAME. Another thing you could do is ALSO check the lengths of each value to see if they are or are not identical. Dave Weaver, Weaver Consulting |
#6
| |||
| |||
|
|
I am doing a compare of a attribute of a file to a table the actual IF statement is IF.IM.REC<114> = UPC THEN GOTO.NEXT.ITEM The actual values are IM.REC<114> = 72288108174 UPC = 00072288108174 the IF statement acts as though it is a MATCH Any ideas? Brain totally fried today and not thinkingclearly Numerically, the NUMBERS are the same! If you treat them as strings by surrounding each with quotes, the values do not equal. Test .... :CT WEAVER FOOFOO FOOFOO 001 REC114 = "72288108174" 002 UPC = "00072288108174" 003 IF REC114 = UPC THEN PRINT "SAME" ELSE PRINT "NOT.SAME" :FOOFOO NOT.SAME : Note: Without the surrounding quotes, it comes up SAME. Another thing you could do is ALSO check the lengths of each value to see if they are or are not identical. Dave Weaver, Weaver Consulting |
#7
| |||
| |||
|
|
Sorry, Dave, but I think I have to disagree. The br.compare mode always acts the same: first it tries to do a command called a POPN to pop a number off the stack. If that succeeds, it does a numeric compare and, in this case, the two "strings" are numerically equivalent. If that fails, then it does a POPS to pop a string and does a string compare. You have to append a non-numeric character of some sort either at the beginning or end of the string to force a string compare. Mark Brown "Dave Weaver" <weaver22 (AT) pacbell (DOT) net> wrote in message news:1115156852.776525.326740 (AT) z14g2000cwz (DOT) googlegroups.com... I am doing a compare of a attribute of a file to a table the actual IF statement is IF.IM.REC<114> = UPC THEN GOTO.NEXT.ITEM The actual values are IM.REC<114> = 72288108174 UPC = 00072288108174 the IF statement acts as though it is a MATCH Any ideas? Brain totally fried today and not thinkingclearly Numerically, the NUMBERS are the same! If you treat them as strings by surrounding each with quotes, the values do not equal. Test .... :CT WEAVER FOOFOO FOOFOO 001 REC114 = "72288108174" 002 UPC = "00072288108174" 003 IF REC114 = UPC THEN PRINT "SAME" ELSE PRINT "NOT.SAME" :FOOFOO NOT.SAME : Note: Without the surrounding quotes, it comes up SAME. Another thing you could do is ALSO check the lengths of each value to see if they are or are not identical. Dave Weaver, Weaver Consulting |
#8
| |||
| |||
|
|
Sorry, Dave, but I think I have to disagree. The br.compare mode always acts the same: first it tries to do a command called a POPN to pop a number off the stack. If that succeeds, it does a numeric compare and, in this case, the two "strings" are numerically equivalent. If that fails, then it does a POPS to pop a string and does a string compare. You have to append a non-numeric character of some sort either at the beginning or end of the string to force a string compare. Mark Brown "Dave Weaver" <weaver22 (AT) pacbell (DOT) net> wrote in message news:1115156852.776525.326740 (AT) z14g2000cwz (DOT) googlegroups.com... I am doing a compare of a attribute of a file to a table the actual IF statement is IF.IM.REC<114> = UPC THEN GOTO.NEXT.ITEM The actual values are IM.REC<114> = 72288108174 UPC = 00072288108174 the IF statement acts as though it is a MATCH Any ideas? Brain totally fried today and not thinkingclearly Numerically, the NUMBERS are the same! If you treat them as strings by surrounding each with quotes, the values do not equal. Test .... :CT WEAVER FOOFOO FOOFOO 001 REC114 = "72288108174" 002 UPC = "00072288108174" 003 IF REC114 = UPC THEN PRINT "SAME" ELSE PRINT "NOT.SAME" :FOOFOO NOT.SAME : Note: Without the surrounding quotes, it comes up SAME. Another thing you could do is ALSO check the lengths of each value to see if they are or are not identical. Dave Weaver, Weaver Consulting |
#9
| |||
| |||
|
#10
| |||
| |||
|
|
Mark Brown wrote: Sorry, Dave, but I think I have to disagree. The br.compare mode always acts the same: first it tries to do a command called a POPN to pop a number off the stack. If that succeeds, it does a numeric compare and, in this case, the two "strings" are numerically equivalent. If that fails, then it does a POPS to pop a string and does a string compare. You have to append a non-numeric character of some sort either at the beginning or end of the string to force a string compare. Mark Brown "Dave Weaver" <weaver22 (AT) pacbell (DOT) net> wrote in message news:1115156852.776525.326740 (AT) z14g2000cwz (DOT) googlegroups.com... I am doing a compare of a attribute of a file to a table the actual IF statement is IF.IM.REC<114> = UPC THEN GOTO.NEXT.ITEM The actual values are IM.REC<114> = 72288108174 UPC = 00072288108174 the IF statement acts as though it is a MATCH Any ideas? Brain totally fried today and not thinkingclearly Numerically, the NUMBERS are the same! If you treat them as strings by surrounding each with quotes, the values do not equal. Test .... :CT WEAVER FOOFOO FOOFOO 001 REC114 = "72288108174" 002 UPC = "00072288108174" 003 IF REC114 = UPC THEN PRINT "SAME" ELSE PRINT "NOT.SAME" :FOOFOO NOT.SAME : Note: Without the surrounding quotes, it comes up SAME. Another thing you could do is ALSO check the lengths of each value to see if they are or are not identical. Dave Weaver, Weaver Consulting Mark, Say what? You disagree with my test code right in front of you? Whether you quote the numbers or prepend or append an alpha character to the numbers treats the numbers as a string. |
|
It is just a matter of "programmer's preference". There are a number of ways to skin this cat! But, the original problem was one of comparing NUMERIC data! 123 = 0000000123 |
|
Hint: Anytime you do a NUMERIC operation (compare, add, subtract, multiply, divide) the leading zeros are stripped! I once saw code a programmer had written consisting of about 15 lines of code to remove the leading zeros! The proper (and easy) way is to just add zero to the number --- walla, the leading zeros are gone! A = 00000456 A = A + 0 PRINT A result: 456 Dave Weaver, Weaver Consulting |
![]() |
| Thread Tools | |
| Display Modes | |
| |