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

Request for File process code!!!!!

Status
Not open for further replies.

vinoth124

Programmer
Dec 14, 2009
3
EU
Dear Friend,

I am new to COBOL programming language. Could you please help me with the below mentioned requirement...

I have 2 input files with below mentioned format

Input file 1 :
**************
SNO X(03)
CODE X(09)
NAME X(68)
Input file 2 :
**************
CODE X(09)
CID X(09)
FILLER X(62)

My aim is to compair the Input file 1 with the input file 2 with CODE value. If the CODE in the input file 1 found the match code from the input file 2 then the o/p should be write in one file. If not found it needs to be write in the other file.


For example:
************
Input file 1 data:
******************
123aaaaaaaaa----------------------
456bbbbbbbbb----------------------
586rrrrrrrrr----------------------
Input file 2 data:
******************
aaaaaaaaa11111111111*************
ccccccccc11111111111*************
qqqqqqqqq11111111111*************

In this scenerio the o/p file 1 should contains
123aaaaaaaaa----------------------

and the o/p file 2 should contains
456bbbbbbbbb----------------------
586rrrrrrrrr----------------------

Thanks in advance for your help :)

Thanks,
Vinoth R
 
Suggest you post on only one(1) forum. . .

What you want is a 2-file match/merge (sometimes called a "line balance") routine.

At the top of the COBOL part of the "other" forum is working code for exactly what you are looking for. . .
 
Here's a simple steps:
1 Read input 1 and create an index file using CODE as index. this has to be unique. Bypass creation if CODE already created. Close input 1 and index file at end of record.

2. Open index file and Read input 2 and find a match against the index file using code value. If found then write to an output file else write to another output file.

If you want step by step program syntax then I suggest to read back your cobol reference guide.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top