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
A table has two indexes defined. Which one will be used by the SEARCH?
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
How to remove the spaces at the end of each record in the output file of variable length, via cobol program?
) How do u handle errors in BMS macro
How you can read the file from bottom?
System Testing for Mainframe Developers What is System Testing? integration testing ? what's the procedure ..
What is the difference between goback, stop run and exit program in cobol?
What is the difference between external and global variables in COBOL?
How do you get the data to code the BMS macro?
Write the code implementing the perform … varying.
How to get the last record in vsam file in cluster? And how can you get the kids file records into your cobol program?
Are you comfortable in cobol or jcl?
How arrays can be defined in COBOL?
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.
how do you define single dimensional array and multidimensional array in your cobol?