01 NAME1 PIC X(13) VALUE "COBOL PROGRAMMING".
01 NAME2 PIC X(13).
now I want to display the value of NAME1 in reverse order
i.e value should be displayed as "GNIMMARGORP LOBOC"
HOW can I do that ??? please let me know if any one knows
it.

Answer Posted / jagan

This should convert the string in reverse order without any
built-in functions . And one more thing is COBOL PROGRAMMING
is actually 17 characters.

DATA DIVISION.
WORKING-STORAGE SECTION.
01 NAME-1 PIC X(17) 'COBOL PROGRAMMING'
01 NAME-2
05 NAME-21 PIC X(1) OCCURS 17 TIMES.

01 I PIC X(2)
01 J PIC X(2)


PROCEDURE DIVISON.
MAIN-PARA.
MOVE 0 TO J.
PERFORM READ-NAME VARYING I FROM 17 BY -1 UNTIL I > 0.
STOP RUN.


READ-NAME
ADD 1 TO J.
MOVE NAME-1(I) TO NAME-21(J).
END-READ-NAME.

Correct me in case any problem with above code.

Is This Answer Correct ?    7 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Define cobol?

856


what is amode(24), amode(31), rmode(24) and rmode(any)?

690


What are the pertinent COBOL

2041


what is s000 u4087 error? please give the all error codes in cobol,jcl.

17026


What is the difference between next sentence and continue in cobol programing language?

706






What are the pertinent COBOL commands?

2620


Which is the default, TEST BEFORE or TEST AFTER for a PERFORM statement?

816


Whats the difference between search & search ALL?

5258


Can a Search can be done on a table with or without Index?

800


What is the difference between structured cobol programming and object alternativelyiented cobol?

751


What is the difference between binary search and sequential search?

638


When is inspect verb is used in cobol?

671


What is inspect in cobol ?

797


Write a program that uses move corresponding.

668


In COBOL, what is the different between index and subscript?

753