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 / vaneesh

Here I am considering INPUT to COBOL working storage
variable and not from file. (If it is input from file then
answer above by Adithya is right).

01 WS-INPUT PIC X(52) VALUE 'AABBCCDDEFGHIIJ.....ZZ'
05 WS-ALPHABET-INP PIC X OCCOURS 52 TIMES.

01 WS-OUPUT PIC X(26).
05 WS-ALPHABET-OUT PIC X OCCOURS 26 TIMES.

01 SUBSRIPTS
05 WS-SUBA PIC 9(2).
05 WS-SUBB PIC 9(2) VALUE 1.

PROCEDURE DIVISION.

PERFORM VARYING WS-SUBA FROM 2 BY 2 UNTIL WS-SUBA > 52

MOVE WS-ALPHABET(WS-SUBA) TO WS-ALPHABET-OUT(WS-SUBB)

ADD +1 TO WS-SUBB

END-PERFORM.

DISPLAY WS-OUPUT

STOP RUN.

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is difference bt COND, REGION & TIME parameters at JOB & EXEC. give an exp.

8655


Can a Search can be done on a table with or without Index?

1034


What is Pic 9v99 Indicates in COBOL?

921


What are the rules of the move verb?

929


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

1079






How to use the same COBOL program in Batch and CICS on lines? explain with an example

2097


How many sections are there in data division in COBOL?

873


Which mode is used to operate the sequential file?

908


What are the different rules to perform a Search?

800


What is the problem of ordered sequential files access?

894


Difference between array and sub-script ?

1357


What is the default value(s) for an initialize? What keyword will allow for an override of the default?

851


what are decleratives in cobol?

1985


INREC AND OUTREC? HOW TO SPLIT 5K RECORDS TO DIFFERENT FILES IN A FILE IN COBOL? RESTART IN COBOL-DB2? ISOLATION LEVELS?

613


What kind of error is trapped by on size error option?

945