IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Count blanks with Rexx


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
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
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: 1306
Location: Vilnius, Lithuania

PostPosted: Wed Sep 02, 2009 12:26 pm
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
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: 1306
Location: Vilnius, Lithuania

PostPosted: Wed Sep 02, 2009 12:44 pm
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: 2358
Location: Israel

PostPosted: Wed Sep 02, 2009 3:15 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Running REXX through JOB CLIST & REXX 13
No new posts Error to read log with rexx CLIST & REXX 11
No new posts To get the count of rows for every 1 ... DB2 3
No new posts isfline didnt work in rexx at z/OS ve... CLIST & REXX 7
No new posts run rexx code with jcl CLIST & REXX 15
Search our Forums:

Back to Top