Ramki,
I think if you just swap the positions of the two functions the
problem will go away. I think the compiler depends on finding the
actual cursor declaration before the OPEN.
HTH.
} Hi All,
} I am getting error on "OPEN and FETCH" stmnt. Could someone help
} on this?
}
} Engine Version: 5.x, 4GL version 4.10UE2.
} h/w is SunOS 4.1.3.
}
} code starts here---------
} MAIN
} CALL validate_ids()
} END MAIN
}
} FUNCTION validate_ids()
} DEFINE
} p_pid char (10) ,
} pccd char (10),
} p_parent_desc char(30)
}
} LET p_pid = "41893"
}
} CALL prep_statements()
}
} OPEN c_sel USING p_pid
} |
} | The cursor "c_sel" has not yet been declared in this program
} | module. It must be declared before it can be used.
} | See error number -4372.
}
} FETCH c_sel into pccd, p_parent_desc
} |
} | The cursor "c_sel" has not yet been declared in this program
} | module. It must be declared before it can be used.
} | See error number -4372.
}
} END FUNCTION
}
} FUNCTION prep_statements()
} DEFINE sel_str char(500)
}
} LET sel_str = " SELECT comp_cd, comp.comp_ident FROM comp ",
} " WHERE comp.comp_id = ? "
}
} PREPARE prep_stmt FROM sel_str
} DECLARE c_sel CURSOR FOR prep_stmt
}
} end function
}
}