Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to operate Character variable in Loop?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
ruodeer

New User


Joined: 06 Jul 2007
Posts: 59
Location: home

PostPosted: Thu Nov 29, 2007 8:02 am    Post subject: How to operate Character variable in Loop?
Reply with quote

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
View user's profile Send private message

saiprasadh

Active User


Joined: 20 Sep 2006
Posts: 154
Location: US

PostPosted: Thu Nov 29, 2007 9:09 am    Post subject:
Reply with quote

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
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Nov 29, 2007 8:29 pm    Post subject:
Reply with quote

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
View user's profile Send private message
ruodeer

New User


Joined: 06 Jul 2007
Posts: 59
Location: home

PostPosted: Fri Nov 30, 2007 7:16 am    Post subject:
Reply with quote

Hi , thank you saiprasadh and Dick.
Now it is clear to me.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Nov 30, 2007 8:36 am    Post subject: Reply to: How to operate Character variable in Loop?
Reply with quote

You're welcome icon_smile.gif

d
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. DSList (3.4) cannot display Chinese c... jacobdng TSO/ISPF 4 Wed Oct 05, 2016 2:51 pm
No new posts Format to pipe delimited with variabl... pshongal SYNCSORT 6 Wed Sep 14, 2016 2:48 pm
No new posts save SAY var loop. italo_pm CLIST & REXX 3 Sun Sep 04, 2016 3:06 am
No new posts Continuation Character ballaswaroop SYNCSORT 8 Thu Aug 25, 2016 4:46 pm
No new posts Variable for cursor names ravikumar15 DB2 5 Sun Jul 17, 2016 7:08 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us