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
Define cobol?
How can i load all the data from a file to Table (array) in cobol.How i manage the occurs clause with out reading the file.Any options avilable ? Please can any one help me it is urgent?
How to remove 2 duplicate records and copy only one using job control language?
How many sections are there in data division in COBOL?
Difference between array and sub-script ?
) how do u code after getting data?
i want a program using by if, evaluate , string, unstring, perform, occurs?
How do get the result of your program directly on your pc?
Which is the default, TEST BEFORE or TEST AFTER for a PERFORM statement?
What are literals?
Which division and paragraphs are mandatory for a COBOL program?
What is cobol?
Can a Search can be done on a table with or without Index?
What is the difference between a binary search and a sequential search? What are the pertinent cobol commands?
Write down the divisions of cobol program?