Ganesh Kumar.J
New User
Joined: 06 Feb 2006 Posts: 4
|
|
|
|
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))
|
|
|
jon_s_rice
Active User
Joined: 24 Mar 2005 Posts: 102 Location: Douglasville, GA USA
|
|
|
|
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. |
|