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
i made it to stage 3 of an interview process wednessday they will quiz my knowledge again face to face for an analyst role recruiter said it will be based on Business requirements system is cobol and good ideas what they might ask etc
What are 77 levels used for?
How you can read the file from bottom?
What is amode(24)?
i want to learn mainframe..any websites and material to learn from basic..? my mail id : rajeswaribe2010@gmail.com
Give some examples of command terminators?
Can we change the password using ALTER? anyone tried and changed?
Name some of the examples of COBOl 11?
What is the difference between PIC 9.99 and PIC9v99?
how do you reference the variable block file formats from cobol programs
can anybody post me about file-aid and changemen tools pls and give me reference if any mainframe guys are there
i want a program using by if, evaluate , string, unstring, perform, occurs?
Can a Search can be done on a table with or without Index?
What are literals?
What is the default value(s) for an initialize? What keyword will allow for an override of the default?