Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


I want to remove a duplicates form a given input field using cobol program. please Any one help me out to solve this ... Thanks in Advance.

Answers were Sorted based on User's Feedback



I want to remove a duplicates form a given input field using cobol program. please Any one help me o..

Answer / meghraj hulawale

Procedure Division.
1.Open vsam file as INPUT mode.
2. Copy the records of VSAM FILE into Table or Array by using occurs clause.
3.Count no. of records in VSAM FILE.
4.By using perform statement.
e.g
perform until I < vsam-cnt
read vsam file
perform until j < no-of-records in table or vsam-cnt
if vsam-data NOT =Table-record
A. Open another Output file as OUTPUT mode.
B. Write output file.
end-if.
increase the value of j as 1.
end-perform.
increase the value I as 1.
end-perform.
Stop run.

******Note
We need to access vsam as sequential.

Is This Answer Correct ?    2 Yes 0 No

I want to remove a duplicates form a given input field using cobol program. please Any one help me o..

Answer / ak

1.copy the file into array
2.read the file entil eof
3.if file-key equals to ws-arry-key(Count)
move ws-arry-key(count) to ws-dup-rec(for duplicate values)
else continue
write ws-arry-key

Is This Answer Correct ?    0 Yes 0 No

I want to remove a duplicates form a given input field using cobol program. please Any one help me o..

Answer / naveenkumar m

As few answered for VSAM file dedup, I will explain for PS flat files,

1) Make sure your file is sorted either Ascending or descending using SORT.

2)FIRST-READ PARA
READ INPUT-FILE INTO WS-ARRAY()
UNTIL EOF
ARRAY-COUNT=ARRAY-COUNT + 1

3)PERFORM COMPARE-PARA VARYING I FROM 1 BY 1 UNTIL I < ARRAY-COUNT
IF WS-ARRAY(I)=WS-ARRAY(I+1) THEN
WRITE DUPLICATE-RECORDS
ELSE
WRITE NODUPLICATE-RECORDS
END-PERFORM

=====================================
I just given algorithm not exact code....

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More COBOL Interview Questions

Difference between cobol and cobol-ii?

0 Answers  


How to get the last record in vsam file in cluster? And how can you get the kids file records into your cobol program?

0 Answers  


Write a program to explain size error.

0 Answers  


With in these three which one is the default one Call Reference, Call By Value, Call By Content.-Which one is default?

4 Answers   IBM,


how to fetch the record before the last record in a cobol file( its a huge file and if the key field is not known)

5 Answers   IBM,


What is the difference between PIC 9.99 and 9v99?

7 Answers  


plz any one tell clearly the justify right clause?

1 Answers  


How to use the same COBOL program in Batch and CICS on lines? explain with an example

0 Answers   IBM,


WHY LRECL NEEDS TO BE 4 EXTRA THEN THE COBOL FILE LENGTH & WHAT IT CONTAIN IN THAT LENGTH

2 Answers   Cap Gemini,


How do you define a variable of comp-1 and comp-2?

0 Answers  


u have passed sme charecters thru parm parameter in jcl. how do u code in cobol to recieve the values u gave in parm ?

2 Answers   IBM,


what are difference organizations in cobol and access mode in cobol? can you expalin what organization means while declaring for ksds,esds,rrds?

1 Answers   HCL,


Categories