Topic: Question about Line() for a binary file (1 of 4), Read 58 times
Conf: VEDIT Macro Language Support
From: Gary Darsey
Date: Tuesday, April 03, 2001 08:31 AM

I am trying to understand the detailed function of SPLITTER.VDM, and I am perplexed but the use of the Line() command in the "file segment writing" part of the macro. After File_Open_Write("...") the commands

Goto_Pos(XXX) Line(1,...)

appear before the commands

File_Write(0) File_Truncate(OK)

to write and close the segment of size XXX above. In a binary file (not line-oriented text), it looks as though the Line() command will move the edit position to the next 0x0A or 0x0D it finds past position XXX, so that the actually amount written more than XXX and cannot be fixed. Am I interpreting this correctly?

What is the relationship between the internal line counter and the edit position in a binary file?

-Gary Darsey

 


Topic: Re: Question about Line() for a binary file (2 of 4), Read 59 times
Conf: VEDIT Macro Language Support
From: Ted Green
Date: Tuesday, April 03, 2001 08:46 AM

At 08:31 AM 4/3/2001, you wrote:
>After File_Open_Write("...") the commands
> Goto_Pos(XXX) Line(1,...)
>appear before the commands
> File_Write(0) File_Truncate(OK)
>
>to write and close the segment of size XXX above. In a binary file (not line-oriented text), it looks as though the Line() command will move the edit position to the next 0x0A or 0x0D it finds past position XXX, so that the actually amount written more than XXX and cannot be fixed. Am I interpreting this correctly?

No. Binary files are typically edited by setting a fixed-length record size, e.g. "64" with {CONFIG, File handling, File type}. Line() then advances to the beginning of the next record. This ensures that fixed-length record files are split between records.

However, if you are trying to edit a binary file in a text mode, e.g.
File type of "0", then Line() would be unpredictable. We always recommend
editing binary files by setting a fixed-length record size.

Ted.

 


Topic: Re: Question about Line() for a binary file (3 of 4), Read 60 times
Conf: VEDIT Macro Language Support
From: Gary Darsey
Date: Tuesday, April 03, 2001 08:56 AM

Ted,

Thanks for the reply. So before using SPLITTER.VDM or something like it for a specific application on a binary file, I guess I make sure the record size is set correctly, then make the "segment" sizes right to get to the end of the record. Then I'll know precisely the "segment" sizes, and the relationship to Line() is my responsibility.

-Gary Darsey

 


Topic: Re: Question about Line() for a binary file (4 of 4), Read 62 times
Conf: VEDIT Macro Language Support
From: Ted Green
Date: Tuesday, April 03, 2001 09:11 AM

Yes, before running SPLITTER.VDM, you must set the correct record length for fixed-length-record data files and for binary files.

VEDIT has an obscure (possibly undocumented) invocation option "-t" to set the record length when opening a file. For example, to open the file data.fil with a record length of 144, give the command:

vpw data.fil -t144

This is equivalent to opening the file normally and then setting {CONFIG, File handling, File type} to "144".

How, lets assume data.file is a 100 meg file which you want to split into ten 10 meg segments. The invocation command to automate this is:

vpw -n10000000 -x splitter.vdm data.fil -t144

This will create the ten files data.xx1, data.xx2, ... data.x10.

Ted.