Reputation: 1
I'm Trying to read Mainframe files using nifi GetFTP, the files which are given as 'JS.XXXX.FLAT.XXXXDB' where as JS, XXX, FLAT being the directories and the file is referenced with absolute file path for file "XXXXDB" and instead of "/" we have "." here.
Nifi is not able to pull these files from the system, whereas I'm able to read from regular ftp,python ftp clients.
please help me know is there a way we can read these files in nifi.
I have tried using GetFTP, GetSFTP, ListFTP/FetchFTP and none of them seem to recognize these files from the backend.
in Python script I tried this and it worked.
def ftp_data_file(data_file, ftp_file_nm):
print("calling ftp_data_file")
writefile = open(data_file, "w")
print("file open for writing:"+data_file)
# Transfer mode ASCII, replacing special chars with space
chars = re.escape(string.punctuation)
ftp.retrlines('RETR ' + ftp_file_nm, lambda s, w=writefile.write: w(re.sub(r'[^a-zA-Z0-9 ' + chars + '\n]', ' ', s) + '\n'))
writefile.close()
Upvotes: 0
Views: 439