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

A table has two indexes defined. Which one will be used by the SEARCH?

757


can you please let me know if there is any walkins for COBOL/PLI/DB2/IMS/JCL in pune other than IBM and ITC infotech

1950


How to remove the spaces at the end of each record in the output file of variable length, via cobol program?

670


) How do u handle errors in BMS macro

1505


How you can read the file from bottom?

658






System Testing for Mainframe Developers What is System Testing? integration testing ? what's the procedure ..

1588


What is the difference between goback, stop run and exit program in cobol?

920


What is the difference between external and global variables in COBOL?

813


How do you get the data to code the BMS macro?

1474


Write the code implementing the perform … varying.

639


How to get the last record in vsam file in cluster? And how can you get the kids file records into your cobol program?

734


Are you comfortable in cobol or jcl?

641


How arrays can be defined in COBOL?

661


I have File 1 occurs 5 times with Employee-ID,Employee-Name,Employee-Dept (EEE and MECH). I have File 2 occurs 10 times with Employee-ID,Employee-Name,Employee-Dept (EEE,CIVIL,CHEMICAL and MECH). In FIle 1 and FIle 2 , for matching Employee-DEPT (Only MECH) , we need to move entire records from file1 to file 2. We should not use 2D array. Your help is needed here.

1113


how do you define single dimensional array and multidimensional array in your cobol?

669