what is the normal way then ? am aware of only this way of working.
In that case, you'll have to read manuals, understand the various syntax for the keywords, understand their usage, and learn to apply them logically to build a program.
Here is a hint at what is happening in the below piece you've given:
You read a file sequentially, if end is reached then you've moved the flag 'Y' to WS-CFILE1-EOF-SW1, but at this point your program still doesn't know what to do with this info; if the end-of-file is reached then should it continue reading, or send the control somewhere else or do something else??
A simple google of the error, or file status 46 returned this link, which states:
46: Logic error condition
A sequential READ, READ NEXT or READ PRIOR statement was attempted on a file open in the input or I-O mode and no valid next record had been established because the preceding START statement was unsuccessful, or the preceding READ statement was unsuccessful or caused an at end condition.
You need to understand the usage of various functions before putting them together in a program; optimize the design logic by understanding the algorthm's flow; that should give you a clean program.
For a beginner, best place to look at is a manual and Google (for any queries).