String Find Example (:F CONTINUE)


 

String Find Example (:F CONTINUE)

 

 NAME

DIM

30

 ADDRESS

DIM

30

 CITY

DIM

17

>STATE

DIM

2

 ZIP

DIM

5

 ROUTE

DIM

4

 CITYSTZ

DIM

30

 .

 

 

 LOOP1

 

 

 

LOOP

 

 

 KEYIN

 *P01:04,"Full Name: ",*EDIT,NAME;

 

 STOP

 IF ESCAPE

 

 CMATCH

 " ",NAME

 

 CONTINUE

 IF EOS

 

 CONTINUE

 IF EQUAL

 

 CMATCH

 "A",NAME

 

 CONTINUE

 IF LESS

 

 CMATCH

 "Z",NAME

 

 CONTINUE

 IF GREATER

 

 BREAK

 IF DOWN

 

REPEAT

WHILE FKEY

 LOOP2

 

 

 

:F CONTINUE

 

After command:

 

 NAME

DIM

30

 ADDRESS

DIM

30

 CITY

DIM

17

 STATE

DIM

2

 ZIP

DIM

5

 ROUTE

DIM

4

 CITYSTZ

DIM

30

 .

 

 

 LOOP1

 

 

 

LOOP

 

 

 KEYIN

 *P01:04,"Full Name: ",*EDIT,NAME;

 

 STOP

 IF ESCAPE

 

 CMATCH

 " ",NAME

>

 CONTINUE

 IF EOS

 

 CONTINUE

 IF EQUAL

 

 CMATCH

 "A",NAME

 

 CONTINUE

 IF LESS

 

 CMATCH

 "Z",NAME

 

 CONTINUE

 IF GREATER

 

 BREAK

 IF DOWN

 

REPEAT

WHILE FKEY

 LOOP2

 

 

Note the following:

  1. Leading blanks were ignored and the match began with the first non-blank data.

  2. The found line becomes the current pointed line.

  3. At the end of file, SUNEDIT wraps around to the beginning of the data file and continues the search.

  4. The file is only searched one time in its entirety.

 

String Find Example (:F2 LOOP)

 

 NAME

DIM

30

 ADDRESS

DIM

30

 CITY

DIM

17

>STATE

DIM

2

 ZIP

DIM

5

 ROUTE

DIM

4

 CITYSTZ

DIM

30

 .

 

 

 LOOP1

 

 

 

LOOP

 

 

 KEYIN

 *P01:04,"Full Name: ",*EDIT,NAME;

 

 STOP

 IF ESCAPE

 

 CMATCH

 " ",NAME

 

 CONTINUE

 IF EOS

 

 CONTINUE

 IF EQUAL

 

 CMATCH

 "A",NAME

 

 CONTINUE

 IF LESS

 

 CMATCH

 "Z",NAME

 

 CONTINUE

 IF GREATER

 

 BREAK

 IF DOWN

 

REPEAT

WHILE FKEY

 LOOP2

 

 

 

:F2 LOOP

 

After command:

 

 NAME

DIM

30

 ADDRESS

DIM

30

 CITY

DIM

17

 STATE

DIM

2

 ZIP

DIM

5

 ROUTE

DIM

4

 CITYSTZ

DIM

30

 .

 

 

 LOOP1

 

 

>

LOOP

 

 

 KEYIN

 *P01:04,"Full Name: ",*EDIT,NAME;

 

 STOP

 IF ESCAPE

 

 CMATCH

 " ",NAME

 

 CONTINUE

 IF EOS

 

 CONTINUE

 IF EQUAL

 

 CMATCH

 "A",NAME

 

 CONTINUE

 IF LESS

 

 CMATCH

 "Z",NAME

 

 CONTINUE

 IF GREATER

 

 BREAK

 IF DOWN

 

REPEAT

WHILE FKEY

 LOOP2

 

 

Note the following:

  1. Only field 2 is to be searched, thus the LOOP label immediately above the found line was bypassed.

  2. The found line becomes the current pointed line.

  3. At the end of file, SUNEDIT wraps around to the beginning of the data file and continues the search.

  4. The file is only searched one time in its entirety.

 

String Find Absolute Example (:FA LOOP)

 

 NAME

DIM

30

 ADDRESS

DIM

30

 CITY

DIM

17

 STATE

DIM

2

 ZIP

DIM

5

 ROUTE

DIM

4

 CITYSTZ

DIM

30

 .

 

 

>LOOP1

 

 

 

LOOP

 

 

 KEYIN

 *P01:04,"Full Name: ",*EDIT,NAME;

 

 STOP

 IF ESCAPE

 

 CMATCH

 " ",NAME

 

 CONTINUE

 IF EOS

 

 CONTINUE

 IF EQUAL

 

 CMATCH

 "A",NAME

 

 CONTINUE

 IF LESS

 

 CMATCH

 "Z",NAME

 

 CONTINUE

 IF GREATER

 

 BREAK

 IF DOWN

 

REPEAT

WHILE FKEY

 LOOP2

 

 

 

:FA LOOP

 

After command:

 

 NAME

DIM

30

 ADDRESS

DIM

30

 CITY

DIM

17

 STATE

DIM

2

 ZIP

DIM

5

 ROUTE

DIM

4

 CITYSTZ

DIM

30

 .

 

 

 LOOP1

 

 

 

LOOP

 

 

 KEYIN

 *P01:04,"Full Name: ",*EDIT,NAME;

 

 STOP

 IF ESCAPE

 

 CMATCH

 " ",NAME

 

 CONTINUE

 IF EOS

 

 CONTINUE

 IF EQUAL

 

 CMATCH

 "A",NAME

 

 CONTINUE

 IF LESS

 

 CMATCH

 "Z",NAME

 

 CONTINUE

 IF GREATER

 

 BREAK

 IF DOWN

 

REPEAT

WHILE FKEY

>LOOP2

 

 

Note the following:

  1. FIND absolute was specified, thus the LOOP statement immediately below the starting line was bypassed as it contained leading blanks.

  2. The found line becomes the current pointed line.

  3. At the end of file, SUNEDIT wraps around to the beginning of the data file and continues the search.

  4. The file is only searched one time in its entirety.

 

String Find In Field Example (:F2,3 LOOP)

 

 

 NAME

DIM

30

 ADDRESS

DIM

30

 CITY

DIM

17

>STATE

DIM

2

 ZIP

DIM

5

 ROUTE

DIM

4

 CITYSTZ

DIM

30

 .

 

 

 LOOP1

 

 

 

LOOP

 

 

 KEYIN

 *P01:04,"Full Name: ",*EDIT,NAME;

 

 STOP

 IF ESCAPE

 

 CMATCH

 " ",NAME

 

 CONTINUE

 IF EOS

 

 CONTINUE

 IF EQUAL

 

 CMATCH

 "A",NAME

 

 CONTINUE

 IF LESS

 

 CMATCH

 "Z",NAME

 

 CONTINUE

 IF GREATER

 

 BREAK

 IF DOWN

 

REPEAT

WHILE FKEY

 LOOP2

 

 

 

:F2,3 LOOP

 

After command:

 

 NAME

DIM

30

 ADDRESS

DIM

30

 CITY

DIM

17

 STATE

DIM

2

 ZIP

DIM

5

 ROUTE

DIM

4

 CITYSTZ

DIM

30

 .

 

 

 LOOP1

 

 

>

LOOP

 

 

 KEYIN

 *P01:04,"Full Name: ",*EDIT,NAME;

 

 STOP

 IF ESCAPE

 

 CMATCH

 " ",NAME

 

 CONTINUE

 IF EOS

 

 CONTINUE

 IF EQUAL

 

 CMATCH

 "A",NAME

 

 CONTINUE

 IF LESS

 

 CMATCH

 "Z",NAME

 

 CONTINUE

 IF GREATER

 

 BREAK

 IF DOWN

 

REPEAT

WHILE FKEY

 LOOP2

 

 

Note the following:

  1. Fields 2 and 3 are to be searched, thus the first LOOP statement becomes the found line.

  2. The found line becomes the current pointed line.

  3. At the end of file, SUNEDIT wraps around to the beginning of the data file and continues the search.

  4. The file is only searched one time in its entirety.

 

String Find in Non Comment Records Example (:FS2 LOOP)

 

 NAME

DIM

30

 ADDRESS

DIM

30

 CITY

DIM

17

>STATE

DIM

2

 ZIP

DIM

5

 ROUTE

DIM

4

 CITYSTZ

DIM

30

 .

 

 

 . LOOP UNTIL A VALID NAME IS ENTERED. IT IS INVALID IF THE

 . NAME IS NULL, STARTS WITH A BLANK, OR NON ALPHA CHARACTER

 .

 

 

 LOOP1

 

 

 

LOOP

 

 

 KEYIN

 *P01:04,"Full Name: ",*EDIT,NAME;

 

 STOP

 IF ESCAPE

 

 CMATCH

 " ",NAME

 

 CONTINUE

 IF EOS

 

 CONTINUE

 IF EQUAL

 

 CMATCH

 "A",NAME

 

 CONTINUE

 IF LESS

 

 CMATCH

 "Z",NAME

 

 CONTINUE

 IF GREATER

 

 BREAK

 IF DOWN

 

REPEAT

WHILE FKEY

 LOOP2

 

 

 

:FS2 LOOP

 

After command:

 

 NAME

DIM

30

 ADDRESS

DIM

30

 CITY

DIM

17

 STATE

DIM

2

 ZIP

DIM

5

 ROUTE

DIM

4

 CITYSTZ

DIM

30

 .

 

 

 . LOOP UNTIL A VALID NAME IS ENTERED. IT IS INVALID IF THE

 . NAME IS NULL, STARTS WITH A BLANK, OR NON ALPHA CHARACTER

 .

 

 

 LOOP1

 

 

>

LOOP

 

 

 KEYIN

 *P01:04,"Full Name: ",*EDIT,NAME;

 

 STOP

 IF ESCAPE

 

 CMATCH

 " ",NAME

 

 CONTINUE

 IF EOS

 

 CONTINUE

 IF EQUAL

 

 CMATCH

 "A",NAME

 

 CONTINUE

 IF LESS

 

 CMATCH

 "Z",NAME

 

 CONTINUE

 IF GREATER

 

 BREAK

 IF DOWN

 

REPEAT

WHILE FKEY

 LOOP2

 

 

Note the following:

  1. The first non-blank characters in field 2 are matched for the LOOP statement only on non-comment records.

  2. The found line becomes the current pointed line.

  3. At the end of file, SUNEDIT wraps around to the beginning of the data file and continues the search.

  4. The file is only searched one time in its entirety.

 

String Locate Example (:L CONTINUE)

 

 NAME

DIM

30

 ADDRESS

DIM

30

 CITY

DIM

17

>STATE

DIM

2

 ZIP

DIM

5

 ROUTE

DIM

4

 CITYSTZ

DIM

30

 .

 

 

 . LOOP UNTIL A VALID NAME IS ENTERED. IT IS INVALID IF THE

 . NAME IS NULL, STARTS WITH A BLANK, OR NON ALPHA CHARACTER

 .

 

 

 LOOP1

 

 

 

LOOP

 

 

 KEYIN

 *P01:04,"Full Name: ",*EDIT,NAME;

 

 STOP

 IF ESCAPE

 

 CMATCH

 " ",NAME

 

 CONTINUE

 IF EOS

 

 CONTINUE

 IF EQUAL

 

 CMATCH

 "A",NAME

 

 CONTINUE

 IF LESS

 

 CMATCH

 "Z",NAME

 

 CONTINUE

 IF GREATER

 

 BREAK

 IF DOWN

 

REPEAT

WHILE FKEY

 LOOP2

 

 

 

:L CONTINUE

 

After command:

 

 NAME

DIM

30

 ADDRESS

DIM

30

 CITY

DIM

17

 STATE

DIM

2

 ZIP

DIM

5

 ROUTE

DIM

4

 CITYSTZ

DIM

30

 .

 

 

 . LOOP UNTIL A VALID NAME IS ENTERED. IT IS INVALID IF THE

 . NAME IS NULL, STARTS WITH A BLANK, OR NON ALPHA CHARACTER

 .

 

 

 LOOP1

 

 

 

LOOP

 

 

 KEYIN

 *P01:04,"Full Name: ",*EDIT,NAME;

 

 STOP

 IF ESCAPE

 

 CMATCH

 " ",NAME

>

 CONTINUE

 IF EOS

 

 CONTINUE

 IF EQUAL

 

 CMATCH

 "A",NAME

 

 CONTINUE

 IF LESS

 

 CMATCH

 "Z",NAME

 

 CONTINUE

 IF GREATER

 

 BREAK

 IF DOWN

 

REPEAT

WHILE FKEY

 LOOP2

 

 

Note the following:

  1. The entire data record is checked to see if {string} exists.

  2. The found line becomes the current pointed line.

  3. At the end of file, SUNEDIT wraps around to the beginning of the data file and continues the search.

  4. The file is only searched one time in its entirety.

 

String Locate In Field Example (:L2 LOOP)

 

 NAME

DIM

30

 ADDRESS

DIM

30

 CITY

DIM

17

>STATE

DIM

2

 ZIP

DIM

5

 ROUTE

DIM

4

 CITYSTZ

DIM

30

 .

 

 

 . LOOP UNTIL A VALID NAME IS ENTERED. IT IS INVALID IF THE

 . NAME IS NULL, STARTS WITH A BLANK, OR NON ALPHA CHARACTER

 .

 

 

 LOOP1

 

 

 

LOOP

 

 

 KEYIN

 *P01:04,"Full Name: ",*EDIT,NAME;

 

 STOP

 IF ESCAPE

 

 CMATCH

 " ",NAME

 

 CONTINUE

 IF EOS

 

 CONTINUE

 IF EQUAL

 

 CMATCH

 "A",NAME

 

 CONTINUE

 IF LESS

 

 CMATCH

 "Z",NAME

 

 CONTINUE

 IF GREATER

 

 BREAK

 IF DOWN

 

REPEAT

WHILE FKEY

 LOOP2

 

 

 

:L2 LOOP

 

After command:

 

 NAME

DIM

30

 ADDRESS

DIM

30

 CITY

DIM

17

 STATE

DIM

2

 ZIP

DIM

5

 ROUTE

DIM

4

 CITYSTZ

DIM

30

 .

 

 

 . LOOP UNTIL A VALID NAME IS ENTERED. IT IS INVALID IF THE

 . NAME IS NULL, STARTS WITH A BLANK, OR NON ALPHA CHARACTER

 .

 

 

 LOOP1

 

 

>

LOOP

 

 

 KEYIN

 *P01:04,"Full Name: ",*EDIT,NAME;

 

 STOP

 IF ESCAPE

 

 CMATCH

 " ",NAME

 

 CONTINUE

 IF EOS

 

 CONTINUE

 IF EQUAL

 

 CMATCH

 "A",NAME

 

 CONTINUE

 IF LESS

 

 CMATCH

 "Z",NAME

 

 CONTINUE

 IF GREATER

 

 BREAK

 IF DOWN

 

REPEAT

WHILE FKEY

 LOOP2

 

 

Note the following:

  1. Field 2 is searched, thus the first LOOP statement is bypassed and the LOOP line becomes the found line.

  2. The found line becomes the current pointed line.

  3. At the end of file, SUNEDIT wraps around to the beginning of the data file and continues the search.

  4. The file is only searched one time in its entirety.

 

String Locate Not Containing Example (:LN NA)

 

 NAME

DIM

30

 ADDRESS

DIM

30

 CITY

DIM

17

 STATE

DIM

2

 ZIP

DIM

5

 ROUTE

DIM

4

 CITYSTZ

DIM

30

 .

 

 

 . LOOP UNTIL A VALID NAME IS ENTERED. IT IS INVALID IF THE

 . NAME IS NULL, STARTS WITH A BLANK, OR NON ALPHA CHARACTER

 .

 

 

 LOOP1

 

 

 

LOOP

 

>

 KEYIN

 *P01:04,"Full Name: ",*EDIT,NAME;

 

 CMATCH

 " ",NAME

 

 CONTINUE

 IF EOS

 

 CONTINUE

 IF EQUAL

 

 CMATCH

 "A",NAME

 

 CONTINUE

 IF LESS

 

 CMATCH

 "Z",NAME

 

 CONTINUE

 IF GREATER

 

 BREAK

 IF DOWN

 

REPEAT

WHILE FKEY

 LOOP2

 

 

 

:LN NA

 

After command:

 

 NAME

DIM

30

 ADDRESS

DIM

30

 CITY

DIM

17

 STATE

DIM

2

 ZIP

DIM

5

 ROUTE

DIM

4

 CITYSTZ

DIM

30

 .

 

 

 . LOOP UNTIL A VALID NAME IS ENTERED. IT IS INVALID IF THE

 . NAME IS NULL, STARTS WITH A BLANK, OR NON ALPHA CHARACTER

 .

 

 

 LOOP1

 

 

 

LOOP

 

 

 KEYIN

 *P01:04,"Full Name: ",*EDIT,NAME;

 

 CMATCH

 " ",NAME

>

 CONTINUE

 IF EOS

 

 CONTINUE

 IF EQUAL

 

 CMATCH

 "A",NAME

 

 CONTINUE

 IF LESS

 

 CMATCH

 "Z",NAME

 

 CONTINUE

 IF GREATER

 

 BREAK

 IF DOWN

 

REPEAT

WHILE FKEY

 LOOP2

 

 

Note the following:

  1. The command was to search all fields for the next record that did not have 'NA' within that record.

  2. The found line becomes the current pointed line.

  3. At the end of file, SUNEDIT wraps around to the beginning of the data file and continues the search.

  4. The file is only searched one time in its entirety.

 

 

See Also: Find Commands, SUNEDIT Commands, Line Edit Mode, SUNEDIT

 



System Utilities Shift Inversion Commands Tab Commands