Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
TO FIND A WORD

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
Author Message
Ganesh Kumar.J

New User


Joined: 06 Feb 2006
Posts: 4

PostPosted: Tue Feb 21, 2006 8:22 pm    Post subject: TO FIND A WORD
Reply with quote

HI !
Can anyone help me to find a word in a column of PDS file, using REXX commands.

I tried the following coding ,it answers for all the steps expect the last step" SAY 'THE POSITION:' POS(STR,PIC,(8))" .i cant able to find the defect , i need correct way to proceed, so please give me some sample coding or valuable suggestions.
Code:
         
/*************REXX***********************************/
SAY 'ENTER THE FILE NAME :'                                             
PULL FNAME                                                             
"ALLOC DA("FNAME") F(MYDD) SHR REUSE"                                   
"EXECIO * DISKR MYDD(STEM STR."                                         
SAY 'THE RECORDS ARE :'                                                 
DO I = 1 TO STR.0                                                       
  RESULT = FIND(STR.I,PIC)                                           
  IF RESULT \= 0 THEN                                             
    DO                                                             
      SAY 'FOUND IN LINE' I                                         
      SAY 'THE STRING IS:' STR.I                                     
    END                                                           
END                                                                     
SAY 'THE POSITION:' POS(STR,PIC,(8))
Back to top
View user's profile Send private message
References
jon_s_rice

Active User


Joined: 24 Mar 2005
Posts: 106
Location: Douglasville, GA USA

PostPosted: Wed Feb 22, 2006 3:01 am    Post subject:
Reply with quote

I recommend not using the variable result. This is a special variable in ReXX. Use some other name such as the following logic starting with the do loop.

do i = 1 to str.0
pic_pos = pos(str.i,"PIC")
if pic_pos \= 0 then do
say "found in line" i
say "the string is str.i
end
end

Your last line of code does not fit in. Note that PIC is in quotes. If it is not in qoutes it will be the value of the variable pic or it will be "PIC" if pic has no value. The last step has the following errors. The varable str has no value. Pic is not in quotes. I'm not sure how the third parameter will be interpreted.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1