Topic: Replacing trailing in fixed length records (1 of 4), Read 46 times
Conf: Basic editing, Block operations
From: Galen Gautreaux
Date: Thursday, October 14, 2004 05:54 PM

I am attempting to replace trailing ascii spaces (x'20') with ebcdic spaces (x'40') in a fixed length record (150 bytes) file.

I launch vedit, load my file, and change config>file handling>file type to 150, and over-write mode to 8.

I then load and execute a macro as follows:
Replace("|W|>","@",BEGIN+ALL+NOERR)

But, the trailing x'20' remain. Why?

 


Topic: Replacing trailing in fixed length records (2 of 4), Read 55 times
Conf: Basic editing, Block operations
From: Christian Ziemski
Date: Friday, October 15, 2004 03:42 AM

> I am attempting to replace trailing ascii spaces (x'20') with
> ebcdic spaces (x'40') in a fixed length record (150 bytes) file.

>I launch vedit, load my file, and change config - file handling
> - file type to 150, and over-write mode to 8.

> I then load and execute a macro as follows:
> Replace("|W|>","@",BEGIN+ALL+NOERR)

> But, the trailing x'20' remain. Why?


You are using |> to match line ends.
But there are no *real* line ends in record mode.
So there will be no matches and therefore no replaces.

And additionally you are trying to replace "|W" (which might be
more than one space) with *one* character "@"
which seems not to be what you planned.

I didn't use record mode for years, so the following macro my not be optimal.


Begin_Of_File
while (! At_EoF) {
Goto_Pos(EoL_Pos) // not real EOL, but virtual one
Search("|! ", REVERSE+NOERR+ADVANCE)
if (! Error_Match) {
Replace_Block(" ", "@", Cur_Pos, EoL_Pos+1, ALL+NOERR)
}
Line(1, NOERR)
}



The EoL handling in VEDIT isn't perfectly consistent yet
(real EOL compared with virtual ones.)
Ted is aware of this. So that may be fixed in a future VEDIT version.


Christian

 


Topic: Replacing trailing in fixed length records (3 of 4), Read 47 times
Conf: Basic editing, Block operations
From: Galen Gautreaux
Date: Monday, October 18, 2004 10:59 AM

This works, but it skips every other record. Why?

 


Topic: Re: Replacing trailing in fixed length records (4 of 4), Read 48 times
Conf: Basic editing, Block operations
From: Christian Ziemski
Date: Monday, October 18, 2004 02:38 PM

On Mon, 18 Oct 2004 10:59:00 -0400, Galen Gautreaux wrote:

>This works, but it skips every other record. Why?

Because I made a mistake?!


Try it with the following:


Begin_Of_File
while (! At_EoF) { // every line up to end
Goto_Pos(EoL_Pos) // not real EOL, but virtual one
if (Match(" ")==0) { // is there a space character?
Search("|! ", REVERSE+NOERR+ADVANCE) // search last no-space
Replace_Block(" ", "@", Cur_Pos, EoL_Pos+1, ALL+NOERR)
} else {
Line(1, NOERR)
}
}



Christian