[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: Re Comparing array element



Tai,

You are only listing the array element and not the array name in the if
statement. If should be like this:

 while camp_array.camp_code(#j) not = $cmp_code and (#j < 19 )

JLKellogg

Tai Luong wrote:
>
> Hi all,
>
> Would somebody tell me how to compare an array element with a
> variable. I have created and loaded the following array, but
> when I try to compare an array element with the following code
> SQR gives me an error. Any help will be greatly appreciated!
>
>   Create-Array
>     Name=camp_array
>     Size=20
>     Field=camp_code:char:1
>     Field=camp_desc:char:20
>     Field=camp_cnt:number:3=0
>
>   move 0 to #j
>   while camp_code(#j) not = $cmp_code and (#j < 19 )
>     add  1  to #arr_idx
>   end-while
>
>   if camp_code(#j) = $cmp_code
>     array-add   1  2   3    to camp_array(#arr_idx)
>            camp_cnt(0) camp_cnt(1) camp_cnt(2)
>   end-if
>
>                      Tai Luong, Programmer/Analyst
> City College of San Francisco             Voice: 415-452-5050
> 50 Phelan Avenue, room LB-2                 Fax: 415-239-3919
> San Francisco, CA 94112                  E-mail: tluong@hills.ccsf.cc.ca.us