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
 

 

Parse a folder path, seperating by each folder

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

New User


Joined: 10 Mar 2008
Posts: 3
Location: USA

PostPosted: Wed May 14, 2008 10:20 pm    Post subject: Parse a folder path, seperating by each folder
Reply with quote

Hello everybody! Thanks for all the help and insight that I have taken from this site to date.

I'm having a difficult time trying to parse a server path string into variables for each folder. I am running into problems where there is a space in the folder name.

For instance: I would like to take \\root\name 1\name 2\name 3 and store each folder name into a variable like this:

fname1 = root
fname2 = name 1
fname3 = name 2
fname4 = name 3


Here is the code that I am working with:

Code:

/* REXX */                                                         
                                                                   
Parse Upper Arg path .                                             
slash = '\'                                                       
parse value path with (slash) fname0 (slash) fname1 (slash) fname2,
     (slash) fname3 (slash) fname4 (slash) fname5 (slash) fname6, 
     (slash) fname7 (slash) fname8 (slash) fname9 (slash)         
                                                                   
say fname0                                                         
say fname1                                                         
say fname2                                                         
say fname3                                                         
say fname4                                                         
say fname5                                                         


With input as:
Code:

\\ROOT\WRKGRP\IT DEVELOPMENT\_INDIVIDUAL FOLDERS


Here is my Ouput:
Code:

READY                                                         
%TESTREXX \\ROOT\WRKGRP\IT DEVELOPMENT\_INDIVIDUAL FOLDERS
                                                             
ROOT                                                     
WRKGRP                                                       
IT                                                           




Any help would be greatly appreciated.
Man I hope I didn't break any forums rules on my first post!

Thanks,
Patrick
Back to top
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10231
Location: italy

PostPosted: Wed May 14, 2008 10:37 pm    Post subject: Reply to: Parse a folder path, seperating by each folder
Reply with quote

it' s not the rexx that is not working,
it' s the invocation format that' s wrong
the tokn You are trying to pass is being resolved as two parameters

IIRC try quoting the invocation parameter

but as a general consideration it is not a safe practice to have path names with embedded blanks
Back to top
View user's profile Send private message
Patrick McGhee

New User


Joined: 10 Mar 2008
Posts: 3
Location: USA

PostPosted: Thu May 15, 2008 1:48 am    Post subject:
Reply with quote

Thank you for the quick reply!

Although I didn't recognize it a first I understand what you are saying. However, even if I put the string in quotes it resolves to the same thing. I am invoking REXX through batch JCL passing in the path name. I would like to pass it in through the JCL to keep from hard-coding it in the REXX.

I understand the complexities with spaces in folder path names but this is something that cannot change. There are spaces in the folder names on our production servers so we have to code for it.


Thanks again,
Patrick
Back to top
View user's profile Send private message
Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2033
Location: Silicon Valley

PostPosted: Thu May 15, 2008 2:09 am    Post subject: Reply to: Parse a folder path, seperating by each folder
Reply with quote

Remove the dot at the end of

Parse Upper Arg path .
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 May 15, 2008 2:10 am    Post subject:
Reply with quote

Hello Patrick and welcome to the forums,

You might try something i'd call a pseudo-blank - a keyboard character that would not ever appear in the string, and would be replaced by an x'40' after the string was broken into the component fields. Things like ~ | ! come to mind as they aren't as likely to be used in designed folder names (seen a few of these that were system generated, but not admin-designed).
Back to top
View user's profile Send private message
Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2033
Location: Silicon Valley

PostPosted: Thu May 15, 2008 2:11 am    Post subject: Reply to: Parse a folder path, seperating by each folder
Reply with quote

also, I question the use of UPPER in the parse statement. I think it is case sensitive.
Back to top
View user's profile Send private message
Ramya A

Active User


Joined: 26 Jul 2004
Posts: 104

PostPosted: Thu May 15, 2008 2:14 am    Post subject: Reply to: Parse a folder path, seperating by each folder
Reply with quote

Hi Patrick,

I just tried your code and it worked fine for me:

Code:
/* REXX */                                                         
                                                                   
say "Enter path name"                                             
pull path                                                         
slash = '\'                                                       
parse value path with (slash) fname0 (slash) fname1 (slash) fname2,
     (slash) fname3 (slash) fname4 (slash) fname5 (slash) fname6, 
     (slash) fname7 (slash) fname8 (slash) fname9 (slash)         
                                                                   
say fname0                                                         
say fname1                                                         
say fname2                                                         
say fname3                                                         
say fname4                                                         
say fname5                                                         


When I executed the above code, I got:

Code:
 Enter path name                               
\\ROOT\WRKGRP\IT DEVELOPMENT\_INDIVIDUAL FOLDERS
                                               
 ROOT                                           
 WRKGRP                                         
 IT DEVELOPMENT                                 
 _INDIVIDUAL FOLDERS                           
                                               
 ***       
Back to top
View user's profile Send private message
Patrick McGhee

New User


Joined: 10 Mar 2008
Posts: 3
Location: USA

PostPosted: Thu May 15, 2008 5:45 pm    Post subject:
Reply with quote

Thanks for all of your help guys!

Pedro,
The REXX invokation worked and parsed correctly when I removed the period from the parse sentence.

Dick,
This method would have been my fallback. Thanks!

Ramya,
I did not try your solution of using the pull method. This would have probably satisfied my needs as well.

Very knowledgeable group of guys here!


Thanks again.

Patrick
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 How to get the right string from Vari... jackzhang75 CLIST & REXX 9 Mon Nov 16, 2015 10:04 pm
No new posts VSAM - Use of DEFINE PATH vs. DEFINE ... Abhi Nature JCL & VSAM 13 Wed Aug 19, 2015 4:35 pm
No new posts Problem using PARSE Roach_MF DFSORT/ICETOOL 3 Tue Mar 17, 2015 11:44 pm
No new posts using Parse on some other operator fo... guptae DFSORT/ICETOOL 6 Thu Dec 11, 2014 11:11 am
No new posts PARSE question re: ABSPOS David Sde DFSORT/ICETOOL 2 Sun Jul 27, 2014 10:09 am


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