I need to do some checking in 2 different AS400 servers. I will read the data from one server(say local) then using connect type 2, connect to the other server(say remote), check the data and then returns back to my local server. I'm using sqlrpg for this and created 2 pgms for this. One will read the local and the other will read the remote. For the first record everything happens to be fine. But when i read the next record in my local, and then try to fetch (m using like in sql and is fine) some selected record from the sql, the sql code is showing me -900. I have added a connect statement in my local too after that remote call is over. But i'm not getting how i can resolve this because if i remove this connect in local i'm getting -501.