writeblock

The writeblock function writes the data contained in the argument of a string variable to the output file. The readblock and writeblock functions are used together to pass a block of data from the input file to the output file without compliance checking or testing for proper EDI syntax. Together, these functions provide a more efficient alternative of using wildcard segments, which are typically implemented in build and break maps.

Readblock, writeblock, and unreadblock are supported only for positional and EDI files, and are not supported for XML files.

Syntax

Use this syntax:



writeblock(string_variable);

Example

An example of this function follows:



while readblock(temp_buffer) do
begin
   if left(tem_buffer,3) = "IEA" then
       begin
            unreadblock();
             break;
        end
   writeblock(tem_buffer);
end
//Read record from input file and place in temp_buffer. Look for
//"IEA" record tag. If found, reset file pointer to where it was
//before the "IEA" record was read. Write contents of temp_buffer to
//output file.

The readblock and writeblock functions are also used in conjunction with the Document Extraction service, to specify the beginning and end of each document in a batch of documents, so that each document can be extracted individually.

For more information about using the corollary Update standard rule to complete the document extraction, see Set an Update Standard Rule as Part of Document Extraction.

Example

Another example of this function follows:



string[250] buffer;
string[3] match;
integer match_len;
 
// set these next two variables
match = "SUM";  // the tag of the last record in the document
match_len = 3;  // the length of the tag
 
// read the block we're on and write it
readblock(buffer);
writeblock(buffer);
 
// keep reading and writing records until the end of the document
while readblock(buffer) do
begin
   writeblock(buffer);
   if left(buffer, match_len) = match then
      begin
         break;
      end
end