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
 

 

Count blanks with Rexx

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

New User


Joined: 22 Jan 2008
Posts: 85
Location: India

PostPosted: Wed Sep 02, 2009 12:08 pm    Post subject: Count blanks with Rexx
Reply with quote

Hi,
Is there any possibility to count the spaces(blanks) through rexx.
I have requirement to send the ps in excel format.
I used CSV method to get the values in columns but i want the excel sheet of same format of the ps.
For eg.
If the statement is "Good Morning . "
After Good i have 4 spaces so in the excel i want four blank columns after Good.
Back to top
View user's profile Send private message

prino

Senior Member


Joined: 07 Feb 2009
Posts: 1028
Location: Oostende, Belgium

PostPosted: Wed Sep 02, 2009 12:26 pm    Post subject:
Reply with quote

Yes, use a do loop to substr every character and test it for blank.

Now, was that too difficult to think of yourself? SIASD!
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Wed Sep 02, 2009 12:31 pm    Post subject:
Reply with quote

Why you want to count the SPACES?
Just parse the string. If you find charactor as SPACE then replace it by "," and one extra for delimiter of next field

Code:

Good    Morning.
to
Good,,,,,Morning.

This will leave 4 blank columns between Good and Morning in Excel.
Back to top
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1028
Location: Oostende, Belgium

PostPosted: Wed Sep 02, 2009 12:44 pm    Post subject:
Reply with quote

And what do you do with comma's that already exist?

The whole requirement is far to fuzzy to make any real sense!

The OP seems to want to put blank columns in Excel, but what is he/she going to do if two records look like

Code:
AA  BB  CC  DD
   XXX  YYYY


Or when the records already contain commas?

The resulting Excel file will look very interesting.
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2360
Location: Israel

PostPosted: Wed Sep 02, 2009 3:15 pm    Post subject:
Reply with quote

A quick method for counting spaces:
Code:

/* REXX */
 
STR = 'GOOD    MORNING'
LEN = LENGTH(STR) - LENGTH(SPACE(STR,0))
 
EXIT


O.
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1281
Location: Belgium

PostPosted: Wed Sep 02, 2009 3:42 pm    Post subject:
Reply with quote

Not an answer, but maybe a solution to the original problem.
In excel you can open CSV's with "Treat consecutive delimiters as one" unchecked.
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
No new posts Passing data from REXX to C programme... chong.zhou CLIST & REXX 2 Wed Jul 26, 2017 9:11 pm
No new posts Passing data from REXX to C programme... chong.zhou All Other Mainframe Topics 0 Wed Jul 26, 2017 4:55 pm
No new posts REXX to get the all datasets name parasmalik20 CLIST & REXX 5 Tue Jul 18, 2017 9:10 pm
No new posts How system know which REXX to excute? jackzhang75 CLIST & REXX 14 Thu Jul 06, 2017 1:09 am
No new posts REXX - Dynamic file Creation d_sarlie CLIST & REXX 7 Tue Jun 27, 2017 7:30 pm


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