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
How to get the last record in vsam file in cluster? And how can you get the ksds file records into your cobol program?
How are the next sentence and continue different from each other?
how we sort two input files based on a common column and giving one o/p file please send me the coding logic?
What is the default value(s) for an initialize? What keyword will allow for an override of the default?
State the various causes of s0c1, s0c5 and s0c7.
What is the difference between PIC 9.99 and 9v99 in COBOL?
How you can characterize tables in cobol?
What is inspect in cobol ?
Can we change the password using ALTER? anyone tried and changed?
How to use the same COBOL program in Batch and CICS on lines? explain with an example
How you can read the file from bottom?
Differentiate cobol and cobol-ii. (Most of our programs are written in cobolii, so, it is good to know, how, this is different from cobol)?
What is the difference between comp and comp-3 usage?
What is the difference between perform … with test after and perform … with test before?
What are the different rules to perform a Search?