Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Need assitance in use of rexx function

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> TSO/ISPF
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    Post subject: Need assitance in use of rexx function
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10374
Location: italy

PostPosted: Fri Mar 25, 2011 4:01 pm    Post subject: Reply to: Need assitance in use of rexx function
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: 1072
Location: Oostende, Belgium

PostPosted: Fri Mar 25, 2011 4:05 pm    Post subject:
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    Post subject: Read line by line and add to a stem
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: 1072
Location: Oostende, Belgium

PostPosted: Fri Mar 25, 2011 6:52 pm    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10374
Location: italy

PostPosted: Fri Mar 25, 2011 6:52 pm    Post subject: Reply to: Need assitance in use of rexx function
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10374
Location: italy

PostPosted: Fri Mar 25, 2011 7:12 pm    Post subject: Reply to: Need assitance in use of rexx function
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    IBMMAINFRAMES.com Support Forums -> TSO/ISPF All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Looping REXX - unable to interrupt RAVISANKAR07 CLIST & REXX 3 Wed Dec 06, 2017 1:08 pm
No new posts The same REXX program doesnt work for... jackzhang75 CLIST & REXX 5 Wed Dec 06, 2017 2:51 am
No new posts Rexx - File tailoring samzee71 CLIST & REXX 10 Thu Nov 30, 2017 10:47 pm
This topic is locked: you cannot edit posts or make replies. Rexx to Grab ISMF Information. upendrasri All Other Mainframe Topics 16 Sun Nov 26, 2017 12:35 am
No new posts Rexx to send an email without SMTP Se... upendrasri All Other Mainframe Topics 12 Sun Nov 19, 2017 7:59 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us