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.
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"<"
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
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
not difficult to modify the checking snippet I posted
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