Recently, I had to create an orchestration that transfers files to the IBM mainframe running z/OS (also called sometimes MVS – Multiple Virtual Storagebecause of the legacy). The orchestration used dynamic FTP port to correlate incoming messages to the destination. During this exercise I learned something about FTPing to the mainframe with BizTalk adapter.

First, flat files obviously must be passed in ASCII mode so the FTP serveris able to convert them to EBCDIC format. Passed in binary modefiles will not be readable as text filessince these two formats have incompatible code pages. Toensure proper conversion set FTP.RepresentationTypeto “ASCII” on the message context.

Second, records in files must be separated with CR LF not just LF as I was getting from UNIX system. Otherwise, only one record was transferred. You’d likely get a message like “250 Transfer completed (data was truncated)”.

Third, record size must be passed to the mainframe system. This is done by setting FTP.BeforePut property to command options like: SITE DCB LRECL=50 RECFM=FB where LRECL sets the record size of 50 characters.

Finally, on some MVS datasets we experienced data truncation even if the LRECL was set properlywhen record size in flat file exceeded 80 characters. Those unlucky files kept getting truncated to 80 characters per records (which is default value for z/OS) until I sent command WRAPRECORD. So, for such cases settingFTP.BeforePut to something like “SITE DCB LRECL=600 RECFM=FB WRAPRECORD” did the trick.