input:-AABBCCDDEFGHIIJ
output:- ABCDEFGHIJ
Here in input we hav the duplicate characters i.e repeating
characters.SO we should eliminate the duplicate characters
and should display the output in ascending order.
Answer Posted / sudhansu
ID DIVISION.
PROGRAM-ID. TESTPRG4.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WS-VAR.
10 WS-VARA PIC X(20).
10 WS-VARB PIC X(20).
10 I PIC 99.
10 J PIC 99 VALUE 1.
10 OCR PIC 99 VALUE 1.
10 WS-TAB.
20 WS-REC OCCURS 10 TIMES.
30 WS-ID PIC X(1) .
PROCEDURE DIVISION.
ACCEPT WS-VARA.
MOVE 'A' TO WS-HOLD.
PERFORM VARYING I FROM 1 BY 1 UNTIL I > 20
MOVE WS-VAR(I:1) TO WS-ID(OCR)
ADD 1 TO OCR
END-PERFORM.
PERFORM VARYING OCR FROM 1 BY 1 UNTIL OCR > 20
IF WS-REC(OCR) NOT EQUAL TO WS-REC(OCR + 1) THEN
MOVE WS-ID(OCR) TO WS-VARB(J:1)
ADD 1 TO J
ELSE
CONTINUE
END-IF
END-PERFORM.
DISPLAY WS-VARB.
STOP RUN.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is the utilization of copybook in cobol? Could we utilize a similar copybook?
What is link edit in cobol?
Difference between cobol and cobol-ii?
What is the difference between structured cobol programming and object alternativelyiented cobol?
How you can read the file from bottom?
What is the Purpose of Pointer in the string?
how to convert the recors form vsam file to db2 table tru file aid
what happens if parmparameter passes zero bytes to the program
explain sorting techniques in cobol program?
What is the difference between a binary search and a sequential search what are the pertinent cobol?
How to change size of Initial number of records to *NOMAX for ALL PF files from perticular library, how can I do that
how do you define single dimensional array and multidimensional array in your cobol?
How do u write test cases?
how do you reference the variable block file formats from cobol programs
Write a program to explain size error.