Page 2 of 2

Re: reverse the order of a string using cobol

PostPosted: Mon Jan 27, 2014 8:28 pm
by tivrfoa
dick scherrer wrote:I would reverse the "string", note the position of the first non-blank, and then move the "right-side" of the string to the output field (using reference modification as you know where to start and can calculate the length of the data to be moved..

Hi d.scherrer,

It would help a lot if you could post code. :D
I don't know how to implement what you're saying. "reference modification"??

Re: reverse the order of a string using cobol

PostPosted: Mon Jan 27, 2014 8:41 pm
by dick scherrer
Hello,

I don't know how to implement what you're saying. "reference modification"??
   MOVE TMP-STR(J:I - J) TO TMP-WORD
You are already using reference modification in your code . . . :?

Where are you "stuck"?

We (i) will help you develop the code, but not do the work for you.

Think about what you want to accomplish using what you have.
1. calculate the length of the data to be moved (using the reversed string).
2. move the reversed data (specifying starst and length) to the output field (after moving spaces to the output field).

Let us know if there are questions or problems.

Re: reverse the order of a string using cobol

PostPosted: Mon Jan 27, 2014 9:01 pm
by tivrfoa
dick scherrer wrote:
   MOVE TMP-STR(J:I - J) TO TMP-WORD
You are already using reference modification in your code . . . :?

So this is reference modification ...
dick scherrer wrote:We (i) will help you develop the code, but not do the work for you.

I'm not the one that created the topic. Code clarifies a lot. You said that wouldn't use STRING and UNSTRING each time thru the loop, so you could have posted some alternative code.

Re: reverse the order of a string using cobol

PostPosted: Mon Jan 27, 2014 10:26 pm
by NicC
so you could have posted some alternative code

Why? Nobody is paying people for their work here. Everyone is supposed to think about solutions - not be spoon-fed like babies.

Re: reverse the order of a string using cobol

PostPosted: Mon Jan 27, 2014 10:53 pm
by dick scherrer
Hello,

Code clarifies a lot. You said that wouldn't use STRING and UNSTRING each time thru the loop, so you could have posted some alternative code.
Grabbing code and shoving it into your porgram is not much clarification. Learning how to implement the code will make it More clear.

I believe i also said i would use the MOVE with reference modification rather than a STRING/UNSTRING.

I'm not the one that created the topic.

You might not have started the topic, but when someone mentions posting code, my usual response is that we will help, but i usually do not post code.