HP3000-L Archives

July 2003, Week 1

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:
"Emerson, Tom" <[log in to unmask]>
Reply To:
Emerson, Tom
Date:
Thu, 3 Jul 2003 08:42:09 -0700
Content-Type:
text/plain
Parts/Attachments:
text/plain (62 lines)
> -----Original Message-----
> From: Peter Osborne [mailto:[log in to unmask]]
> 
> We have a program that reads ... Fixed ASCII. Unfortunately,
> the files I need it to read are bytestream. ... what 
> (scriptable) way of convert files from bytestream to 256 
> Fixed ascii in mass quantity?

commercial solution: MPEX's %ALTFILE command has a parameter/option to change to and from "bytestream"; as this is a fileset-handling command, you can use wildcards and selectors in your filename.

shell solution: you can often do "fileset handling" things with a (posix) shell script using the built-in "for" command of the shell [from the man page]:

     sh(1)                 MPE/iX Shell and Utilities                 sh(1)
     ______________________________________________________________________

     for variable [in word ...]
     do command
     done
          The for statement sets variable to each word argument in turn,
          and executes the set of commands once for each setting of
          variable. If you omit the in word part, sh sets variable to each
          positional parameter.  You may divert the flow of control within
          the loop with the break(1) or continue(1) statements.

this is often combined with the ability to pipe the output of a command, such as "find", to get a more "fine-tuned" selection of files than simply "*"

That said, the posix shell provides a couple of functions: frombyte and tobyte, that performs the conversion.  Again, to the man pages:

     tobyte(1)             MPE/iX Shell and Utilities             tobyte(1)
     ______________________________________________________________________

     NAME
          tobyte -- convert MPE record files to byte stream files

     SYNOPSIS
          tobyte -at mpe_file [hfs_filename]

     DESCRIPTION
          The tobyte utility reads the file specified as mpe_file and
          writes it to the file specified as hfs_filename in byte stream
          form.  mpe_file must be either an MPE file.group.acct style name
          or an HFS (Hierarchical File System) name with a leading slash
          (that is, /name) or dot-slash (that is ./name) hfs_filename must
          be an HFS name.  If hfs_filename is omitted, the standard output
          is used.  If no options are specified, tobyte treats mpe_file as
          a binary file.

     Options

          -a   opens mpe_file as an ASCII file.

          -t   strips trailing blanks from each line in an ASCII file.  You
               can only use this option when you have also specified the -a
               option.
====

actually, I just noticed a caveat on the FROMBYTE program:
"...It creates either a fixed-record 80-byte ASCII file (MPE text file) or a fixed-record 120-word binary file...".  Since you explicitly want 256 byte fixed, this won't help.

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

ATOM RSS1 RSS2