View previous topic :: View next topic
|
Author |
Message |
ruodeer
New User
Joined: 06 Jul 2007 Posts: 58 Location: home
|
|
|
|
I have a requirement:
want to generate strings A1 - Z9(A1,A2.....B1...Z9) in Rexx,
I try to write following Loop clause but get syntax error.
Code: |
do i='A' to 'Z' <----- here is detected error!
do j=1 to 9
say "generated:"||i||j
end
end |
could some friends help me out on this ? thanks! |
|
Back to top |
|
|
saiprasadh
Active User
Joined: 20 Sep 2006 Posts: 154 Location: US
|
|
|
|
Hi,
I hope the below code will meet your requirement.
Code: |
LP='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
DO I= 1 TO 26
STR = SUBSTR(LP,I,1)
DO J=1 to 9
SAY "GENERATED:"||STR||J
END
END |
Thanks
Sai |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
I try to write following Loop clause but get syntax error. |
The error is because 'A' and 'Z' are not numeric.
Also, keep in mind that even if the process could increment from A to Z, there are values between A and Z that you would not want.
For example the letter I is x'C9' - the letter J is x'D1'. Your process (if it could work) would include the values from x'CA' thru x'CF' and i'm sure you would not want them. |
|
Back to top |
|
|
ruodeer
New User
Joined: 06 Jul 2007 Posts: 58 Location: home
|
|
|
|
Hi , thank you saiprasadh and Dick.
Now it is clear to me. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
You're welcome
d |
|
Back to top |
|
|
|