Page 1 of 1

ftp mode

Posted: Tue Jun 07, 2011 5:55 pm
by fmou
Hi,

I heard the saying that

- source data from mainframe dataset should be ftped using the binary mode, whereas
- COBOL copybook files should be ftped using th text mode

I'm wondering if the above absolutely necessary? what'd happen otherwise. what's the general guild-line choosing the ftp mode.

thanks

Posted: Wed Jun 08, 2011 12:35 pm
by jwiles
Mainframe files typically contain non-character data (integers, packed decimal primarily) which would likely be corrupted if the ASCII (text) transfer type is used with FTP. The ASCII/text transfer mode will also convert EBCDIC characters to ASCII (this is the source of the corruption of non-character data).

COBOL copybooks are text files which are included during the compilation of a COBOL program (similar to #include in C/C++). Usually they can be safely transfered using ASCII/text mode.

Rule of thumb on almost all platforms: If you are absolutely certain that there is NO non-character data in a file, you are USUALLY safe using the ASCII/text transfer mode. Otherwise, use the binary transfer mode to avoid possible data corruption.

Regards,

Posted: Wed Jun 08, 2011 1:55 pm
by fmou
many thanks for the explanation of why those mode are chosen.

Are COBOL copybooks normally of EBCDIC characters?

thanks

Posted: Wed Jun 08, 2011 3:41 pm
by FranklinE
Last question first: a copybook is just the COBOL version of a schema. It's programming code, specifically names of fields and their attributes. The character set is not relevant at that level.

James provided a good answer, and this is my two cents about an additional point specific to DataStage.

Mainframe files should be read -- unless your shop has unusual things going on -- as binary data directly into the table definition created from importing the COBOL copybook. Further, the record type should be set to implicit. In fact, if you clear the settings on the Format tab, right click on Record level and select down on "Format as" to "Mainframe (COBOL)", you will have the default format settings you need. Your FTP stage handles the rest.

I strongly recommend learning by doing. Create a simple job to read a mainframe file using FTP Enterprise. Import your copybook as "COBOL file definitions" and let DS be your guide.

Good luck.