View previous topic :: View next topic
|
Author |
Message |
senthilnathanj
New User
Joined: 31 Jul 2007 Posts: 47 Location: chennai
|
|
|
|
Hi Guys,
what is the output of the below code. Please explan briefly.
Code: |
CALL REVERSEIT('PL/I');
(SUBSCRIPTRANGE,SIZE,STRINGSIZE);
REVRESEIT:[b] PROC(31);[/b]
DCL (I,J) BIN FIXED(31);
DCL (S,T) CHAR(100) VARYING;
T=S;
J=0;
DO I = LENGTH(S) TO 1;
J = J + 1;
SUBSTR(T,J,1) = SUBSTR(S,I,1);
END;
PUT(T);
END; |
|
|
Back to top |
|
|
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1193 Location: Dublin, Ireland
|
|
|
|
Why don't you try it and see? Did you mean to have spelt REVRESEIT in line 3?
Garry. |
|
Back to top |
|
|
donateeye Warnings : 2 New User
Joined: 01 Jun 2007 Posts: 62 Location: chennai
|
|
|
|
Line 3: REVERSEIT OR REVRESEIT ??
In the DO loop, seems like you need step -1
rest its fine, i think you would get the reversed string... |
|
Back to top |
|
|
|