Syntax
LOCATE expr IN dynamic.array,STARTPOS BY sort.expr SETTING variable THEN statements ELSE statements
Additional Information
Sort.Expr :AL -> Ascending left(Alpha sort)
AR -> Ascending right(Numeric sort)
DL -> Descending left(High-low alpha sort)
DR -> Descending right(High-low numeric sort)
Example
DAYS = "MON:"FM:"TUE":FM:"WED":FM:"THU":FM:"FRI" LOCATE "WED" IN DAYS SETTING FOUND ELSE FOUND = 0 CRT "Position of WED in DAYS dynamic array :":FOUND LOCATE "SAT" IN DAYS BY "AL" SETTING POS ELSE INS "SAT" BEFORE DAYSEND CRT "Position where SAT has been inserted :":POS CRT "Days dynamic array after inserting SAT :":DAYS
Output
Position of WED in DAYS dynamic array : 3Position where SAT has been inserted : 2
Days dynamic array after inserting SAT : MON||SAT||TUE||WED||THU||FRI
0 comments:
Post a Comment