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!

COBOL/400 assistance

Status
Not open for further replies.

Uvaiz

MIS
Jun 13, 2003
38
CA
200-PROCESS-RECORD-RTN.

MOVE WS-FIRST-NAME TO TR-FIRST-NAME
READ BLACKLST
INVALID KEY
PERFORM 215-READ-MFAIVRP-RTN
NOT INVALID KEY
PERFORM 205-WRITE-RECORD-RTN
END-READ.

215-READ-MFAIVRP-RTN.
READ MFAIVRP
AT END
MOVE 'NO' TO ARE-THERE-MORE-IVRP
END-READ.
MOVE FIRST-NAME OF MFAIVRP TO WS-FIRST-NAME.
MOVE INITIALS OF MFAIVRP TO WS-MIDDLE-NAME.
MOVE LAST-NAME OF MFAIVRP TO WS-LAST-NAME.
MOVE LEGAL-NAME OF MFAIVRP TO WS-LEGAL-NAME.
MOVE SOCIAL-INSURANCE-NO OF MFAIVRP TO WS-SOI-NUMBER.
MOVE COUNTRY-CODE OF MFAIVRP TO WS-CNTRY-CODE.

The above program looks for the first name and if this is found in BLACLST the 205-write-record-rtn is performed. This works fine.

But before performing 205 I would also like to test for LAST-NAME in file MFAIVRP with the TR-LAST-NAME in file BLACLST.

I am encountering errors with all my attempts.

Hope someone can help me.

Thanks
Tony
 
Something like:
Code:
MOVE WS-FIRST-NAME TO TR-FIRST-NAME 
    READ BLACKLST 
      INVALID KEY 
         PERFORM 215-READ-MFAIVRP-RTN 
      NOT INVALID KEY 
         MOVE WS-LAST-NAME to TR-LAST-NAME
         READ BLACKLIST KEY IS TR-LAST-NAME
             INVALID KEY
                  CONTINUE
             NOT INVALID KEY
                  PERFORM 2XX-SOMETHING_ELSE
         END-READ
         PERFORM 205-WRITE-RECORD-RTN 
    END-READ.
Adjustments required for actual name of keys etc.


Tom Morrison
 
Thanks TOM,

Just clarifying your statements.

MOVE WS-LAST-NAME to TR-LAST-NAME
READ BLACKLIST KEY IS TR-LAST-NAME
INVALID KEY

Does this means that if the first-name is validated to be equal your above statement then matches if the last-name is correct for the same record. Is it how it works.

Sorry I am not too experienced in COBOL and would appreciate your guidance.

Thanks.
Tony
 
Tony,

Since I cannot see your entire program, I cannot answer the question, "Does this means that if the first-name is validated to be equal your above statement then matches if the last-name is correct for the same record[?]"

However, I think that you might want something more along the lines of:
Code:
    MOVE WS-FIRST-NAME TO TR-FIRST-NAME 
    READ BLACKLST 
      INVALID KEY 
         PERFORM 215-READ-MFAIVRP-RTN 
      NOT INVALID KEY 
         IF WS-LAST-NAME NOT EQUAL TR-LAST-NAME
              PERFORM 215-READ-MFAIVRP-RTN
         ELSE
              PERFORM 205-WRITE-RECORD-RTN 
         END-IF
    END-READ.
Best of luck!

Tom Morrison
 
Thank you very much TOM for your solution. Much appreciated.

It is indeed what I wanted and seems to be working. I must create some dummy records to make certain that every thing works fine.

Trust I can come to you should I need assistance.

Thank you

Tony
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top