Index problem with awk

Hello,

I have this code:

#!/bin/sh
awk -v val="........." 'BEGIN{FS=OFS=" ";c=0}
NR==FNR&&d==0{a[$0]=$0; c++;next}
FNR==(NR-c){b[FNR]=val;next}
{if(1234 in a){print "okay"}}
{print $1}' listi fpr.11 grn

that is working (awk find the value in the table "a" and return "okay" followed by 1234)

and when I am using:

#!/bin/sh
awk -v val="........." 'BEGIN{FS=OFS=" ";c=0}
NR==FNR&&d==0{a[FNR]=$0; c++;next}
FNR==(NR-c){b[FNR]=val;next}
{if(1234 in a){print "okay"}}
{print $1}' listi fpr.11 grn

awk returns me "1234" but not "okay", meaning that it did not find 1234 in my list (but of course 1234 is in the list!!).

Does someone has any idea why I have this problem?

Thanks

for ss in array searches the subscripts, not the values in the array. In the second script, you have 1234 as a value, not a subscript.

Good to know...thanks!!

How can I change that?
I would like to search among the values in the array and not among the subscripts...I know I can do it with loop:

 
for (j in array){if(1234==array[j]){print "okay"}}

but is there a specific command to test the content of an array?