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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Question: Validation on fields where different because of spaces. 1

Status
Not open for further replies.

BlueRoses

Programmer
Nov 28, 2000
2
US
Okay, I'm totally stumped, working on my Senior project and desparately need help!

This is what I need to do. I have a name1 and a field name2.

I already have checked to see if they are spaces and if they are the same. Now I need to check if they are different to make sure the difference isn't just an unwanted space.

I figured I would use a loop to "suck the spaces" out of each field and compare the exact alphabetic structured fields, but I'm not sure of the way to write it and how to write out the field if they truly are "different" in it's original form.

PLEASE HELP, FAST!

 
You can build a shift left on more than one space.

Something like:

PERFORM VARYING SUB-1 FROM 1 BY 1 UNTIL SUB-1 > LENGTH OF NAME-1 - 3
IF NAME-1(SUB-1:2) = SPACE
NAME-1(SUB-1:) = NAME-1 (SUB-1 + 1:)
END-IF
END-PERFORM

I didn't test this and the compiler can complain about overlapping fields ... bla bla etc. but that doesn't matter, just bringing back more than one space into just a single one. After that doing this also with name-2, you should be able to compare them.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top