I found a way to determine if the path on mainframe is a file or PDS (analogically a directory ) . I used org.apache.hadoop.fs.ftp.FTPFileSystem
library and the following snippet would work by returning the list of files .
FTPFile[] files = ftp.listFiles();
Looping through the files
and checking file1.isFile()
would suffice.
Again remember to change to the current working directory before listing the files using ftp.cwd(inputPath);
For an explanation on Mainframe file system please refer to Bruce Martin's answer and the comments that follow. .