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 regarding perform varying

Status
Not open for further replies.

BlueRoses

Programmer
Nov 28, 2000
2
US
Thank you for the help Crox.

I have one more question. According to your example, is this how I should go about it.

name1 pic x(30).
name2 pic x(30).
check-name pic x(30).
check-name2 pic x(30).

etc.

...

IF NAME1 = NAME2
CONTINUE (HAVE THIS ACTUALLY IN A DIFFERENT "PARAGRAPH"
ELSE
MOVE NAME1 TO CHECK-NAME
MOVE ' ' TO REPORTNAME1
MOVE NAME2 TO CHECK-NAME2
MOVE ' ' TO REPORT-NAME2
PERFORM CHECK-CHARACTERS
END-IF.

CHECK-CHARACTERS.

PERFORM VARYING SUB-1 FROM 1 BY 1 UNTIL SUB-1 > 30.
IF CHECK-NAME(SUB-1:2)= SPACE
CHECK-NAME(SUB-1:)= CHECK-NAME(SUB-1 + 1:)
END-IF.
IF CHECK-NAME2(SUB-1:2) = SPACE
CHECK-NAME2(SUB-1)=CHECK-NAME2(SUB-1+1:)
END-IF.
IF CHECK-NAME = CHECK-NAME2
MOVE REPORTNAME1 TO REPORT-LINE1
WRITE REPORTLINE1
ELSE
MOVE REPORTNAME1 TO REPORT-LINE1
WRITE REPORTLINE1
MOVE REPORTNAME2 TO REPORT-LINE2
WRITE REPORTLINE2
END-IF.
END-PERFORM.


Your help is wonderful, and I truly appreciate the insite.


 
it looks good. After deleting the extra spaces, you can compare the names again. If they are the same, the difference was only with the spaces.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top