HP OpenVMS Systems

ask the wizard
Content starts here

DCL and large records in files?

» close window

The Question is:

How can I extract and manipulate records from an input file that are fixed at
 1223 bytes using DCL?  I am not opposed to breaking these records into
 multiple pieces if I need to, I just don't know how to do this using DCL.
 Because of time constraints, I
am using DCL because It would take too long for me to brush up on my C

The Answer is :

  These records are larger than those typically supported by DCL.
  If the records are truly in a fixed-length-record sequential file,
  and you are indeed willing to break the records into pieces, then
  you could request RMS temporarily treat the file as one with shorter
  records. You would have to pick a record size that divides evenly
  into (in this case) 1224 -- and realize that every 1224-th byte is
  random (RMS odd-length fixed-length record fill byte).  Specifically:
$DIR/FULL x.dat ! Check for fixed length 1223
$SET FILE/ATTR=(MRS=408,LRL=408)   ! Break record into 408 byte chunks
$OPEN/READ/WRITE file x.dat
$READ file part_1
$READ file part_2
part_2 ... = ...
$WRITE/UPDATE file part_2
$READ file part_3
$CLOSE file
$SET FILE/ATTR=(MRS=1223,LRL=1223) ! Reset file to original record size

answer written or last revised on ( 12-MAR-2001 )

» close window