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


Please Help Members By Posting Answers For Below Questions

Why occurs cannot be used in 01 level in COBOL?

713


what is amode(24), amode(31), rmode(24) and rmode(any)?

693


Which mode is used to operate the sequential file?

659


What is redefines clause in COBOL?

846


Explain sorting techniques in cobol program? Provide the sort file definition, the sort statement, its syntax and meaning

680






How do you reference the following file formats from cobol programs?

693


How to fetch 1000 error records from VSAM file(Eg: 1000000 records present) while getting SOC7 abend ?

1931


What are various search techniques in cobol? Explain.

644


Why is it necessary that file needs to be opened in I-O mode for REWRITE?

747


input= ,,,, mainframe training ,,, hyderabad .... location.... output1=$ mainframe training in hyderabad location$ output2=**** mainframe training in hyderabad location ****. In this pgn when we give input considering the spaces the output is displayed in this format.Like in the place of ,,,, $ should be displayed likewise.So please helpmeout.

1779


Define cobol?

857


Give some examples of command terminators?

752


Which is not true about evaluate statement

1568


Explain how you can characterize tables in cobol?

636


What is a scope terminator give example?

655