HP3000-L Archives

September 2002, Week 4

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Tom Emerson <[log in to unmask]>
Reply To:
Tom Emerson <[log in to unmask]>
Date:
Fri, 27 Sep 2002 13:46:06 -0700
Content-Type:
text/plain
Parts/Attachments:
text/plain (45 lines)
> -----Original Message-----
> From: [log in to unmask]
>
> I assume that this is a simple problem that someone here has already
> solved... [convert var-length bytestream file to fixed length]

Wouldn't the HP supplied FROMBYTE/TOBYTE programs do this?  At the very
least, "frombyte" would convert this to a VARIABLE length file, which in
turn can be FCOPY'd to a fixed length file as needed...

> and still terminated with CRLFs.

that doesn't make sense -- if the record is "fixed length", why would there
be any need for a CR/LF?

Actually, my first thought was a "simple COBOL program" along these lines:

 DATA DIVISION.
   01  FIXED-BUFFER.
       05  VAR-BUFFER  PIC X(whatever).
       05  filler    pic x value %15.
       05  filler    pic x value %12.

 PROCEDURE DIVISION.

   MOVE   SPACES TO VAR-BUFFER
   ACCEPT VAR-BUFFER FREE
   DISPLAY FIXED-BUFFER.

[in a loop until EOF/EOD, of course...]

Note: the code above is simply being "paranoid" ;) -- I *think* pre-loading
the input buffer with spaces may not be needed...

Of course, if the CR/LF thing is "still a problem", you might have to do
some string manipulation/searching for the "original" CR/LF and replace them
with spaces, i.e.,

   INSPECT VAR-BUFFER
     REPLACING ALL %15 WITH SPACES
               ALL %12 WITH SPACES.

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

ATOM RSS1 RSS2