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: 1017
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: 1017
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
This topic is locked: you cannot edit posts or make replies. Need help on If condition continuatio... ashok_uddaraju CLIST & REXX 4 Fri May 19, 2017 8:55 am
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts Running an REXX EXEC implicitly sho7hills CLIST & REXX 3 Thu Apr 20, 2017 8:14 am
No new posts Need help in REXX CALL program Raje1002 CLIST & REXX 5 Wed Apr 19, 2017 11:18 pm


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