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 return code

Former Member
0 Likes
385

HI All,

am reading data from the unix directory using open data set stmt.

sample code :

OPEN DATASET ws_unix_dir_and_filename FOR INPUT IN LEGACY TEXT MODE.

IF sy-subrc EQ 0.

CLOSE DATASET ws_unix_dir_and_filename.

ELSE.

WITH 'File: ' ws_unix_dir_and_filename ' not found!'

RAISING inv_input_parameters.

the above code was excuted in background mode , so job failed with retun code 2, this is happening some times only.

my question is when the above code failes with retun code 2.

regards,

DSK

1 REPLY 1
Read only

Former Member
0 Likes
327

Hi,

When the specified file is not found the return code will be 2.

However to rectify the eroor message try like this.

OPEN DATASET ws_unix_dir_and_filename FOR INPUT

IN TEXT MODE

ENCODING DEFAULT.

IF sy-subrc EQ 0.

CLOSE DATASET ws_unix_dir_and_filename.

ELSE.

Regards,

Rama.