![]() ![]() Although it does support flat files (it calls them *FIXED) it has some restrictions. But CPYFRMIMPF works best with CSV files. In many cases, a file downloaded with sftp can still be copied to Db2 for i tables using CPYFRMIMPF file. So first we needed to get it into a flat file in the Db2 (or QSYS) file system. In the past, we copied it to an interim flat file and then from there to an externally described file. But this file had something weird, it had a multiformat, varying length record structure. This story contains code, which you can download here.Īt first, I thought I might be able to use sftp to download the file and then use something like CPYFRMIMPF or CPYFRMSTMF to convert the data to Db2 for i format. This means we have to change the code to handle this situation. It just doesn’t automatically do ASCII to EBCDIC translations. Which is not to say that only image or binary files may be transferred sftp can transfer anything. In fact, the IBM i PASE/QShell sftp doesn’t seem to support ascii/text file transfers, which is when the CCSID conversion could be performed. Consequently, sftp does not do CCSID conversions. It also is “just a port” of sftp from (probably) IBM’s AIX operating system, which may have been itself ported from FreeBSD. Sadly, unlike the FTP tool that runs natively on IBM i, the sftp client is PASE or QShell based. However, the days of using FTP are over and sftp is now required by most vendors. ![]() The reason I know it is COBOL is because when they sent me the file layout, the specs where actually in COBOL.įor the last 18 years, this file has been retrieved using FTP to the various IBM i platform names every day without a hitch - I’d guess that’s nearly a record for EDI content. This file is created at a vendor that runs IBM mainframes (an actual mainframe by the way) and the file is created on their system as output from a COBOL program. Recently I had a situation where what the client calls an “EDI File” was being downloaded using sftp on the IBM server running i. Often that entails writing a User-Defined Function (UDF) for use in SQL, but sometimes a CL command is the better choice. Sometimes I have to invent a missing piece of the puzzle. Using SQL frequently, as I do, I tend to look for solutions to problems that can be resolved using the database language (i.e., SQL). Guru: Copy From Stream File FMTOPT(*NOCHK) ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |