Jump to page titleUNITED STATES
hp.com home products and services support and drivers solutions how to buy
» contact hp

:

more options
 

hp.com home
End of Jump to page title
Example-PLI How To Bypass "RECORD DOESN'T MATCH TARGET LENGTH" Error
Jump to content



» 

business support center

Home & Home Office Support:
» HP branded products
» Presario branded products
» Services & Warranties
Small & Medium Business Support:
» Small & Medium Business products
» Small & Medium Business services
Support for IT Professionals:
» Enterprise products (IT Resource Center)
» NonStop enterprise products
» Business & IT Services
Content starts here
Copyright (c) Digital Equipment Corporation 1988. All rights reserved
LAYERED PRODUCT or COMPONENT: PLI, VERSION 3.1     OP/SYS: VMS V5.0

SOURCE:     Digital Customer Support Center



SYMPTOM:

A PLI warning message is generated when trying to read a variable
length record into a fixed length buffer:

            "record does not match target length"


ANALYSIS:

The error is generated because RMS is expecting a variable length buffer.


SOLUTION:

The following program demonstrates how to read a variable length
record into a fixed length buffer.

$!
$! An input file named OUTFILE.DAT must be created before running this
$! program.  This command procedure creates the file then compiles, links
$! and runs the program.
$!
$ create outfile.dat
$ deck
This is just some miscellaneous text to test this program which
demonstrates how to read variable length records without getting
an error.
$ eod
$ pli/obj=read_rec sys$input
getvar: proc options(main);

/*
A variable length file normally is read into a variable length buffer.
Otherwise a "Record length does not match target" warning message is
generated.  By setting up the input buffer as follows, execution does not
produce this error message.  The UNION clause causes INREC and INRECV to
have the same address.  The part0 field contains the actual length of the
inrectop record.  The two extra bytes do not show up in the inrecv field
because it is variable length.  In short, read the record into a variable
length buffer and reference any fields by their names in the fixed length
buffer.
*/

dcl infile file record input env(maximum_record_size(75));
dcl 1 inrectop union,
  2 inrec,
      3 part0   char(2),
      3 part1   char(75),
  2 inrecv char(75) var;

dcl eof bit(1);

on endfile(infile) eof = ('1'b);

open file(infile) title('OUTFILE.DAT');
read file(infile) into(inrecv);
do while (^eof);
  put skip list('Part1=',part1);
  part1 = '';
  read file(infile) into(inrecv);
end;
close file(infile);
end getvar;
$ lin read_rec
$ run read_rec



buy online or call 1.800.AT.COMPAQ
privacy statementusing this site means you accept its terms