2008 Jan 08 6:32 AM
During the OPEN DARASET statement , when should we open a file in BINARY MODE &when in TEXT MODE?
2008 Feb 15 4:48 AM
Hi All,
When should we go for BINARY MODE & When should we go for in TEXT MODE?
Could any body give me a clear idea. Which one is default we can use
Binary mode or Text mode.??
Thank you,
Vikram.C
2008 Jan 08 6:33 AM
in binary mode, the data is transferred byte by byte
in text mode, the data is transferred line by line
Madhavi
2008 Jan 08 6:35 AM
Hi,
Binary mode: data will be fetched byte by byte
Text mode: Fetched as line by line.
2008 Feb 15 4:48 AM
Hi All,
When should we go for BINARY MODE & When should we go for in TEXT MODE?
Could any body give me a clear idea. Which one is default we can use
Binary mode or Text mode.??
Thank you,
Vikram.C
2008 Feb 15 4:51 AM
OPEN DATASET <dsn> [Additions].
This statement opens the file <dsn>. If you do not specify any additions for the mode, the file is opened in binary mode for reading.
2008 Feb 15 4:57 AM
Hi Dude,
Here is the answer,
To determine whether to open a file IN TEXT MODE or IN BINARY MODE, you need to know how the file is structured.
If the file is structured in lines (or records), open it IN TEXT MODE.
If the file is structured byte-by-byte, open it IN BINARY MODE.
These two structure modes affect the processing of sequential files.
With the TRANSFER statement:
If you transfer a structure to a file opened IN TEXT MODE, the whole structure will be transferred and the system will mark the end of the line. On the next transfer, the system will start at the next line.
If you transfer a structure to a file opened IN BINARY MODE, the whole structure will be transferred. On the next transfer, the system will start at the next character position.
With the READ DATASET statement (see example above):
If you read from a file opened IN TEXT MODE, one record of the file will be read into the structure. If the record is shorter than the structure, the structure is padded with spaces. If the record is longer than the structure, the record is truncated. On the next read, the next record is read into the structure.
If you read from a file opened IN BINARY MODE, the length of the structure determines how many characters are read. On the next read, the system starts with the next character and again reads as many characters as can fill the structure.
Regards,
Lakshmanan
2008 Feb 15 4:59 AM
Hi Dude,
To determine whether to open a file IN TEXT MODE or IN BINARY MODE, you need to know how the file is structured.
If the file is structured in lines (or records), open it IN TEXT MODE.
If the file is structured byte-by-byte, open it IN BINARY MODE.
These two structure modes affect the processing of sequential files.
With the TRANSFER statement:
If you transfer a structure to a file opened IN TEXT MODE, the whole structure will be transferred and the system will mark the end of the line. On the next transfer, the system will start at the next line.
If you transfer a structure to a file opened IN BINARY MODE, the whole structure will be transferred. On the next transfer, the system will start at the next character position.
With the READ DATASET statement (see example above):
If you read from a file opened IN TEXT MODE, one record of the file will be read into the structure. If the record is shorter than the structure, the structure is padded with spaces. If the record is longer than the structure, the record is truncated. On the next read, the next record is read into the structure.
If you read from a file opened IN BINARY MODE, the length of the structure determines how many characters are read. On the next read, the system starts with the next character and again reads as many characters as can fill the structure.
Regards,
Lakshmanan