Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

OPEN DATASET

Former Member
0 Likes
823

Hi all,

Can anyone tell me that will open dataset give an error, if the file which i am opening is not downloaded fully in my application server.

The file which i will be accessing using open dataset, read dataset and close dataset will be loaded in my application server.

Regards,

Neo.

7 REPLIES 7
Read only

Former Member
0 Likes
772

Hey it depends in what mode you are trying to open the file.

If you are not opening in read mode, may be it will throw an error.

regards,

Sandeep Josyula

  • reward if useful

Read only

andreas_mann3
Active Contributor
0 Likes
772

Hi,

use an "end-record" at the end of your processing.

(transfer 'EOF' to file. )

so it can be checked,whether your file is complete,

when opening your file

Anderas

Message was edited by: Andreas Mann

Read only

Former Member
0 Likes
772

Hi,

The open dataset will not give error if the file is not downloaded completely. It will give error if the file you are trying to read does not exists or the path where you are trying to write is incorrect and also if you donot have file permissions on the server.

Hope ths helps.

Read only

Former Member
0 Likes
772

Open data set will returns SY-SUBRC value. If it is other than ZERO, some error has occured.Pls try to findout the meaning for different SY-SUBRC values so that u can capture the type of error

Read only

Former Member
0 Likes
772

From your question I understand that the file is being written on the application server while you are trying to open. In case that file is already open, then when you try to open, it will set SY-SUBRC to a nonzero value, which is an error. .

Let me know if you have any further queries.

Don't forget to mark helpful answers!

Gaurav Parmar.

Read only

0 Likes
772

From your explanation what i can understand is that i dont have to specifically check for the downloading of the file to be complete on the application server.

As if it is being downloaded and while downloading i try to open it with open dataset the sy-subrc will be non-zero.

Regards,

Altaf Shaikh.

Read only

Former Member
0 Likes
772

Further, read below:

OPEN DATASET <dsn> FOR OUTPUT.

If the file does not already exist, it is created automatically. If it does already exist, but is closed, its contents are overwritten. If the file exists and is already open (for read or write access, or for appending), the position is reset to the beginning of the file. If the system can open the file <dsn> successfully, SY-SUBRC is set to 0. If not, it is set to 8.

OPEN DATASET <dsn> FOR INPUT.

The file must already exist, otherwise, the system sets SY-SUBRC to 8, and ignores the statement.

If the file exists and is already open (for read or write access, or for appending), the position is reset to the beginning of the file. However, it is good programming style to close files that are already open before you reopen them for a different operation

Hope that helps you. Let me know if you have any further queries.

Don't forget to mark helpful answers!

Gaurav Parmar.