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 rmode(24)
In COBOL, what is the different between index and subscript?
What is the utilization of copybook in cobol?
HOw can I get the negative sign while deduct high value from low value
Which Search verb is equivalent to PERFORM…VARYING?
How do u write test cases?
In which area will you utilize 88 level items in cobol?
What type of SDLC u followed? Why?
What is the difference between a binary search and a sequential search what are the pertinent cobol?
How many bytes S(8) comp field occupy and its maximum value?
What is rmode(any) ?
System Testing for Mainframe Developers What is System Testing? integration testing ? what's the procedure ..
Which is the default, TEST BEFORE or TEST AFTER for a PERFORM statement?
if we display var1 then what will b displayed in below condition. 77 var1 pic s9(2) value -10. 77 var1 pic s9(2) value -11. " " " -12. " " " -13. -14 ... ... -19.
What is the difference between Global and External Variables?