Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Do Case

Status
Not open for further replies.

pwright

Technical User
Joined
Feb 13, 2002
Messages
3
Location
US
I am trying to use Do Case to update fields in a very large file. I'm having trouble with the exact structure of the code.

i.e. - existing field value = "ARABIC"
new value = "A"

existing field value = "ASIAN"
new value = "B"
 
replace (field) with the fieldname you are working with.
do case
case (field) = "ARABIC"
replace (field) with "A"

case (field) = "ASIAN"
replace (field) with "B"
endcase


If you are working with memory variables:
do case
case m.field = "ARABIC"
m.field = "A"

case m.field = "ASIAN"
replace m.field with "B"
endcase

I hope that helps.
 
PWRIGHT do you want to replace all the records in the file with one value if the field equals another value? In that situation a case statement would not be required.

lcField = ALIAS.FIELDNAME
replace all (lcfield) with "A" for (lcField) = "ARABIC"
replace all (lcfield) with "B" for (lcField) = "ASIAN"
etc David W. Grewe
Dave@internationalbid.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top