I am writing a CL program in which I do OPNQRY file based on status field in the file. After this data selection, an RPG program is called which processes the data and changes the status to next status. After the execution of this I call another CL program. In this CL program, I want to copy query file to a temporary file. After positioning the pointer to starting of file using POSDBF, I do CPYFRMQRYF but it does not copy any records. However, if in data selection in first CL program, if I give order numbers instead of status, the logic work fine. Can anyone please advise what am I missing here.