Results 1 to 2 of 2

Thread: how will you write a logic for this in cobol?

  1. #1
    Contributing Member
    Join Date
    Sep 2006
    Answers
    962

    how will you write a logic for this in cobol?

    I have 3 files . 2 files have millions of records.These 2 files have one ( empnumber) common record field. i want to put those records in 3rd file , such that which records having same number in key field (empnumber)in these two files ?

    How will you write a logic for this in cobol?

    One way is:

    Read file1 until EOF1 or EOF2
    Read File2 Until EOF2 or File1-Key >File2-key
    If File1-key = File2-key
    Write .....
    End-If
    End-Read
    End-Read.


    But READ stmt dont have UNTIL.
    So it is to be done thru PERFORM stmt.
    Can u write a full logic in cobol?

    /* This question was asked by savvy */


  2. #2
    Junior Member
    Join Date
    Jun 2007
    Answers
    2

    Re: how will you write a logic for this in cobol?

    1.First, convert both the files into Indexed Sequential with Empno as key.
    2. Now ;
    Perform Write-File-para thru Write-File-para-Exit until EOF = 'y'.
    ....
    Write-File-para.
    Move Rec-1-Emp-no to Rec-2-Emp-no.
    Read File-2 key is Rec-2-Emp-no
    invalid key go to Write-File-para-Exit.
    Move spaces to Rec-3 <* Initialize record
    String Rec-1 Rec-2 into Rec-3 delimited by size.

    Write-file-para-exit.
    Read File-1 next at end move 'Y' to EOF.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact