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
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 |
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 |
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 |
How does IDMS communicate with CICS?
What is the difference between CONTINUE & NEXT SENTENCE ?
What is cobol?
ID DIVISION. PROGRAM-ID. PLO. DATA DIVISION. WORKING-STORAGE SECTION. 01 VAR1 PIC 9(2). 01 VAR2 PIC X(2). PROCEDURE DIVISION. ACCEPT VAR2. MOVE VAR2 TO VAR1. STOP RUN. if i give 'PI' in var2 then what will b output of progr. any abend?????
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.
What is the difference between write & move in COBOL?
I hv ten records in ps file and i hv say some 15 records in vsam file .i hv empno and age in ps file n empno,empname,dept n desig in vsam file. i hv 2 read the ps file n check wid matching empno in vsam file and then insert all fields from ps and vsam into db2 table....plz help in writin the procedure division
wht is load module and object module ?
OCCURS clause is used in the DATA DIVISION on data names at (a) 01 level (b) 77 level (c) 88 level (d) any level from 02 to 49
How to read records from flat file in reverse order through COBOL program?
14 Answers Accenture, Broadridge, IBM, MAT, Polaris, SPIC, Syntel, TCS, Wipro,
What is COMP SYNC?
what is call by value and call by reference ?
3 Answers Infosys, ITC Indian Tobacco Company,