progolf069
Programmer
This is a similar question to the one I posted a few weeks ago about P.O. Boxes, but this time I need to compare data inputed by the user to a field in a file. The application is a e-mail search engine on our main frame at our office. Our employees, if they would like to be able to look up another employee's e-mail address they will be able to by inputing that employee's name, and it would return their address on the screen.
If the user inputed John, they would get a result that looks like this:
If the user inputed Smith, they would get a result that looks like this:
If you can provide me with any ideas, I would appreciate it! Thanks again for everybodys advice! It is very appreciated!
Ian
Here is the important parts of my program currently: (minus the large screen section that is irrelevent to this post)
Code:
Example:
Example Data File: (top line not part of file, only for identification purposes)
Employee Name Employee e-mail
John Doe doey@ourname.com
Sue Smith ssmithy@ourname.com
John Nondoe notdoey@ourname.com
Sara Smith ssmith2@ourname.com
Bill Jones bjones@ourname.com
Code:
Employee Name Employee e-mail
------------------ -----------------------
John Doe doey@ourname.com
John Nondoe notdoey@ourname.com
If the user inputed Smith, they would get a result that looks like this:
Code:
Employee Name Employee e-mail
------------------ -----------------------
Sue Smith ssmithy@ourname.com
Sara Smith ssmith2@ourname.com
If you can provide me with any ideas, I would appreciate it! Thanks again for everybodys advice! It is very appreciated!
Ian
Here is the important parts of my program currently: (minus the large screen section that is irrelevent to this post)
Code:
IDENTIFICATION DIVISION.
PROGRAM-ID. emaildir.
AUTHOR. IAN WICKLINE.
INSTALLATION. K'S MERCHANDISE INC.
DATE-WRITTEN. JULY 18 2001.
******************************************************************
* ALLOWS USER TO SEARCH FOR E-MAIL ADDRESSES FOR CORP *
******************************************************************
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT INPUT-FILE
ASSIGN TO 'C:\EMAIL\ksemail'
ORGANIZATION IS LINE SEQUENTIAL.
DATA DIVISION.
FILE SECTION.
FD INPUT-FILE.
01 INPUT-REC.
05 NAME-OUT PIC X(30).
05 ADDRESS-OUT PIC X(25).
WORKING-STORAGE SECTION.
01 INPUT-RECORD.
05 NAME-IN PIC X(30).
05 ADDRESS-IN PIC X(25).
01 ARE-THERE-MORE-RECORDS PIC XXX VALUE "YES".
01 ARE-YOU-SURE PIC X.
01 SHOW-EMAIL PIC X(43).
01 SHOW-MORE PIC X.
01 L-CTR PIC 99 VALUE 4.
01 WS-NAME.
05 SEARCH-NAME PIC X(30).
01 REDEFINES WS-NAME.
05 NAME-CHAR OCCURS 30 TIMES PIC X.
01 WS-REC-NAME.
05 REC-SEARCH-NAME PIC X(30).
01 REDEFINES WS-REC-NAME.
05 REC-NAME-CHAR OCCURS 30 TIMES PIC X.
01 CTR PIC 99.
01 INSPECT-CTR PIC 9.
01 EXIT-PROG PIC X VALUE " ".
PROCEDURE DIVISION.
100-MAIN-MODULE.
OPEN INPUT INPUT-FILE.
PERFORM 250-PROMPT-RTN.
GO TO 999-EXIT.
250-PROMPT-RTN.
DISPLAY TITLE-SCREEN
DISPLAY SEARCH-SCREEN.
ACCEPT SCR-NAME-IN
* IF NAME-IN = " "
* GO TO 999-EXIT
DISPLAY DETAIL-LINE-HEADER-SCREEN
PERFORM UNTIL ARE-THERE-MORE-RECORDS = "NO "
READ INPUT-FILE
AT END
MOVE "NO " TO ARE-THERE-MORE-RECORDS
GO TO 500-SEARCH-AGAIN
NOT AT END
PERFORM 300-COMPARE
END-READ
END-PERFORM.
300-COMPARE.
MOVE FUNCTION UPPER-CASE (NAME-IN) TO NAME-IN
MOVE FUNCTION UPPER-CASE (NAME-OUT) TO NAME-OUT
STRING
NAME-IN DELIMITED BY ' '
INTO WS-NAME
STRING
NAME-OUT DELIMITED BY ' '
INTO WS-REC-NAME
MOVE ZEROS TO CTR
MOVE ZEROS TO INSPECT-CTR
PERFORM VARYING CTR FROM 1 BY 1
UNTIL CTR > 30
IF NAME-CHAR(CTR) = REC-NAME-CHAR(CTR)
ADD 1 TO INSPECT-CTR
IF INSPECT-CTR > 4
MOVE 50 TO CTR
PERFORM 400-ADD-NAME.
400-ADD-NAME.
MOVE SPACES TO SHOW-EMAIL
STRING
ADDRESS-OUT DELIMITED BY ' '
'@ksmerchandise.com' DELIMITED BY ' '
INTO SHOW-EMAIL
ADD 1 TO L-CTR
DISPLAY DETAIL-LINE-RECORD-SCREEN.
500-SEARCH-AGAIN.
DISPLAY SEARCH-AGAIN-SCREEN
ACCEPT SCR-MORE
IF SHOW-MORE = 'Y' OR 'y' OR " "
PERFORM 250-PROMPT-RTN.
999-EXIT.
CLOSE INPUT-FILE.
STOP RUN.