Reverse the value in COBOL.
Posted: Mon Dec 21, 2015 4:31 pm
Hi,
Another question which I face goes like this:
I have a string of size 26. Basically it's the letters from alphabet. With value like "ABCDE....WXYZ". Now I want to display this variable in reverse direction like "ZYXW....EDCBA".
I replied that we can do it using OOCURS. In which I can start from 26 and subtract 1 until the counter reach to 1. But question became complex when he said what if you don't know the PIC clause value of the variable?
Another question with which I need he is, he told that there can be other ways to do it but I could not answer. What are the other ways?
Another question which I face goes like this:
I have a string of size 26. Basically it's the letters from alphabet. With value like "ABCDE....WXYZ". Now I want to display this variable in reverse direction like "ZYXW....EDCBA".
I replied that we can do it using OOCURS. In which I can start from 26 and subtract 1 until the counter reach to 1. But question became complex when he said what if you don't know the PIC clause value of the variable?
Another question with which I need he is, he told that there can be other ways to do it but I could not answer. What are the other ways?