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
how do you reference the fixed unblock file formats from cobol programs
Program A (Normal COBBAT) calling a B Program (DB2COBOL, COBBATDB which is using a VSAM file. its a dynamic call. How we will handle VSAM file decleration in our from JCL from where we are running A PGM. And should we have PLAN for A pGM also. if possible can some one post a sample JCL. Thanks for help in advance.
What is the difference between binary search and sequential search?
i was faced one question- i have value -00001234.56 Suppress the zeroes and the output should be -1234.56 But Not - 1234.56 spaces should not be available after suppressing the zeroes. logic in jcl and cobol?
can anybody post me about file-aid and changemen tools pls and give me reference if any mainframe guys are there
What is the difference between PIC 9.99 and PIC9v99?
Explain the configuration section of a cobol program with examples of syntax.
What is the difference between a binary search and a sequential search? What are the pertinent cobol commands?
Why is it necessary that file needs to be opened in I-O mode for REWRITE?
What are the different rules of SORT operation?
how to access the file from prodution from changeman tool and to submit a file to production
What is the utilization of copybook in cobol? Could we utilize a similar copybook?
How do you reference the following file formats from cobol programs?
What is amode(24), amode(31), rmode(24) and rmode(any) (applicable to only mvsesa enterprise server) ?
What is the difference between Call and a Link?