I have the requirement to compare the two files and pick up
the matching records.
File 1. file2
23 32
32 13
34 15
35 36
36 35
43
Get the matching records from this 2 files to out file. how
you will do this in cobol program?
Answer Posted / soumya santosini patnaik
first load the files in shorted order after that code a
matching program. in the procedure division check the file1
entry with file2 entry if file1 entry = file2 entry then
then write to o/p file end-evaluate esle check for file1<
file2 (if yes then the pointer is brought down to the 2nd
rec of file1 and checked with 1st rec of file2 when the
para is performed for 2nd time),if the above condition is
false then it checks if file1>file2 if yes then pointer is
brought down to the next entry of file2 and checked with
1st entry of file1 with 2nd entry of file2 in next perform
and the process is done till the end of records.
| Is This Answer Correct ? | 11 Yes | 1 No |
Post New Answer View All Answers
) how do u code after getting data?
How to fetch 1000 error records from VSAM file(Eg: 1000000 records present) while getting SOC7 abend ?
Can a Search can be done on a table with or without Index?
I have program P1 which calls file F1 which has 100 records and following structure 001 .................. 002 .................. 003 .................. 098 .................... 099 ................... 100 .................... Now I want to read these files and write these records in file F2 in following manner. 001 ...... 051 ..... 002 ...... 052 ..... 003 ...... 053 ..... .......... ....... .......... ....... .......... ....... 048 ........ 098 ...... 049 .......... 099 ....... 050 .... 100 ......
For rewrite, why is it mandatory that file needs to be opened?
I need to compare 3 variables(dates) and do some processing based on the earliest date. There could be more then 1 date record in any of the 3 fields. What is the best way to code this?
please..could u give an example about USAGE IS POINTER ..and explain why and when we use it ?
What is the difference between next sentence and continue in cobol programing language?
What is the utilization of copybook in cobol? Could we utilize a similar copybook?
What is redefines clause in COBOL?
What are the cobol coding sheets?
What is the difference between PIC 9.99 and 9v99 in COBOL?
Which division and paragraphs are mandatory for a COBOL program?
i was faced one question- i have value -00001234.56 Suppress the zeroes and the output should be -1234.56 But Not - 1234.56 spaces should not be available after suppressing the zeroes. logic in jcl and cobol?
How to know whether the module is dynamical or statistical?