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

Need assitance in use of rexx function


IBM Mainframe Forums -> TSO/ISPF
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
abhikulsh
Currently Banned

New User


Joined: 17 Feb 2011
Posts: 12
Location: chennai

PostPosted: Fri Mar 25, 2011 3:53 pm
Reply with quote

Hi

I have around 300 members, in each of the member i have

something like this
// GL0504=%GL0504,
// ENDDT=%@GL0504,
i need to find '=%' in all members and then save the rest of the part before comma is encountered in a file.i.e i wanna save GL0504 in a file.

I want to know rexx part to find and save the the thing after '=%' in some variable.the rest of the things i know and i will be able to do.

Can u pls guide
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Mar 25, 2011 4:01 pm
Reply with quote

learn to post consistent info on the requirement
the sample result is does not agree with the <spoken> requirement

in case 1 ok for GL0504
in case 2 the spoken requirement yields @GL0504

Code:

string = "// GL0504=%GL0504,"
parse var string  . "=%" token "," .
say ">"string"< >"token"<"

string = "// ENDDT=%@GL0504,"
parse var string  . "=%" token "," .
say ">"string"< >"token"<"


and here the same snippet with error detection
Code:


string = "// GL0504=%GL0504"
startp = pos("=%",string)
if startp = 0 then do
    say "no delimiting '=%' found in ==>"string
    exit
end
startp = startp + 2
endpos = pos(",",string,startp)
if endpos = 0 then do
    say "no delimiting ','  found in ==>"string
    say "tokenizing to end of string"
    token = substr(string,startp)
end
else ,
    token = substr(string,startp,endpos-startp)
say ">"string"< >"token"<"
Back to top
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1306
Location: Vilnius, Lithuania

PostPosted: Fri Mar 25, 2011 4:05 pm
Reply with quote

Of course we can guide you. Just read Edit and Edit Macros and come back if you still have questions.
Back to top
View user's profile Send private message
abhikulsh
Currently Banned

New User


Joined: 17 Feb 2011
Posts: 12
Location: chennai

PostPosted: Fri Mar 25, 2011 6:27 pm
Reply with quote

my actual requirement is, this is my file content

/*%OPC SEARCH NAME=(@@CURDAY08%OYMD1,CURDA
/*%OPC CURDAY25%OYMD1)
/F0091$#P EXEC F0091C#P,
/ GL0504=%GL0504, YYMM
/ ENDDT=%@GL0504, CCYY
/ SEC=P27, INPU
/ LET=Q, LETT
/* ACSPARM=F0091SQ3,
/ JOBNAME=F7023SQ3

I need to extract the things after '%=', clearly parse var works , i m reading the file , and i wanna find if =% exists , if yes then i wanna append the part after %=, before comma into a stem

also
in some of the files i have
ENDDT=%@GL0504,DDATE=%@DL0504,KLDATE=%@HL0305

I NEED to find in such a way that even in single line if there are multiple =%, it shud append into the stem, i will read that stem later..Kindly guide
Back to top
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1306
Location: Vilnius, Lithuania

PostPosted: Fri Mar 25, 2011 6:52 pm
Reply with quote

Of course we can guide you. Just read Edit and Edit Macros and come back if you still have questions.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Mar 25, 2011 6:52 pm
Reply with quote

You have no right to complain... You got what You asked for in the initial post
not our fault if You do not have the skill to post the complete requirement

Quote:
I NEED to find in such a way that even in single line if there are multiple =%, it shud append into the stem, i will read that stem later..Kindly guide


why should anybody kindly guide somebody who is not able to tell the whole requirement from the beginning ?

and maybe after further guidance the requirement will change
not worth wasting time icon_evil.gif

not difficult to modify the checking snippet I posted
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Mar 25, 2011 7:12 pm
Reply with quote

very good mood on


Code:
string = "// GL0504=%GL0504,GL0505=%GL0505,GL0506=%GL0506,GL0507=%GL0507,"
startp = pos("=%",string)
i = 0
token.0 = 0
do while ( startp > 0 )
    i = i + 1
    startp = startp + 2
    endpos = pos(",",string,startp)
    if endpos = 0 then do
        token.i = substr(string,startp)
        token.0 = i
        leave
    end
    token.i = substr(string,startp,endpos-startp)
    token.0 = i
    startp = pos("=%",string,endpos+1)
end
do  i = 1 to token.0
    say i token.i
end

the stem usage shown is for a series of tokens in the same string
up to You to expand to a global stem

final note... also the topic title is wrong,
You do not need help with rexx functions You need to be spoon fed on a simple parsing logic
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 -> TSO/ISPF

 


Similar Topics
Topic Forum Replies
No new posts Compile Several JCL JOB Through one r... CLIST & REXX 4
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 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