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 have a File that has duplicate records. I need only those records that occur more than
thrice.?

Answer Posted / nsingh

DEFINE A TABLE

01 TABLE.
05 TABLE-A OCCURS 500 TIMES
INDEXED BY IDX
10 TEXT PIC X(100)
10 COUNT PIC9(4).

01 W-REC PIC X(100).
01 W-OUT PIC X(100).
01 SUB S9(4) COMP VALUE 0
PROCEDURE DIVISION.

INITIALIZE TABLE-A

READ-PARA.
READ F1 IN W-REC
AT END
SET IDX TO 1
PERFORM VARING SUB FROM 1 BY 1 UNTIL SUB > 500
IF COUNT(IDX) > 3
WRITE W-OUT FROM TEXT(IDX)
ELSE
SET IDX UP BY 1
END-IF
END-PERFORM
STOPRUN
NOT AT-END
CONTINUE
END-READ

SEARCH TABLE-A
AT END
PERFORM TABLE-ENTRY
WHEN W-REC = TEXT(IDX)
ADD +1 TO COUNT
END-SEARCH

GO TO READ-PARA

TABLE-ENTRY.
SET IDX TO 1
PERFORM VARYING SUB FROM 1 BY 1
UNTIL SUB > 500
IF TEXT (IDX) = SPACES
MOVE 1 TO COUNT (IDX)
MOVE W-REC TO TEXT (IDX)
ELSE
SET IDX UP BY 1
END-IF
END-PERFORM

Is This Answer Correct ?    1 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

HOw can I get the negative sign while deduct high value from low value

2262


what is the difference between COBOL2 AND COBOL390?

3071


Difference between array and sub-script ?

1671


What are the different rules for performing sort operation?

1233


State the various causes of s0c1, s0c5 and s0c7.

1096


What is the difference between PIC 9.99 and 9v99 in COBOL?

1343


What is the use of intialize verb?

1263


write a cobol logic. i have file that has 10 records .1 record go to first output file and second record goes to 2 output and etc

1245


What is the utilization of copybook in cobol? Could we utilize a similar copybook?

1234


What is difference between static and dynamic call in cobol?

1400


i need a small 3d program using inline and outline.

2223


What is inspect in cobol ?

1313


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

1180


Can we redefine the field of x(200) to less than 200?

1381


Explain how to differentiate call by context by comparing it to other calls?

1194