[comp.unix.wizards] IBM, HONEYWELL OCTAL CODES TO UNIX PROBLEM

LOGSAMS@a.isi.edu (Charles F. Ashley) (10/21/89)

PROBLEM : UNISYS 5000/80 INTERFACING WITH IBM/HONEYWELL.

Here's a challenge to the UNIX professionals. My agency has hit a
programming snag in rewriting our programs from the HONEYWELL to
the Army's UNISYS 5000. On this side of the ocean, we are baffled
as to a solution:

Problem Definition:

THE PROBLEM OCCURS WHEN UPLOADING OR DOWNLOADING VARIABLE-LENGHT RECORD
FORMATS USING 9 TRACK MAGNETIC TAPES. THE IBM AND HONEYWELL USE A FOUR-BYTE
RECORD CONTROL WORD (RCW) THAT SUPPLIES THE LENGHT OF THE RECORD AND A
FOUR-BYTE BLOCK CONTROL WORD (BCW). IN SHORT, UNISYS READS BOTH BCW AND RCW
AS THEIR ACTUAL OCTAL REPRESENTATION CAUSING THE TAPE TO APPEAR AS ONE
CONTINUOUS HUGE RECORD WITHOUT INDIVIDUAL RECORDS.

Question: HOW CAN AN IBM OR HONEYWELL RECORD WITH OCTAL CODES BE READ INTO
THE UNISYS 5000 SYSTEM? LISTED BELOW ARE BOTH UNBLOCKED AND BLOCKED
PICTORIAL REPRESENTATIONS OF THE RECORDS FORMAT.

EXAMPLE 1:
UNBLOCKED RECORDS +-----------------------------------------+
                  | BCW | RCW | RECORD | BCW | RCW | RECORD |
                  |  4  |  4  |  300   |  4  |  4  |   200  |
                  | 308 | 304 |record 1| 208 | 204 |record 2|
                  +-----------------------------------------+
THE RCW CONTAINS THE LENGHT OF THE RECORD PLUS ITS OWN LENGHT OF 4.
THE BCW CONTAIN THE LENGHT OF THE RCW PLUS ITS OWN LENGHT OF 4.

EXAMPLE 2:
BLOCKED RECORDS   +--------------------------------------------------+
                  | BCW | RCW | RECORD | RCW | RECORD | RCW | RECORD |
                  |  4  |  4  |  300   |  4  |  200   |  4  |  250   |
                  | 766 | 304 |record 1| 204 |record 2| 254 |record 3|
                  +--------------------------------------------------+

THE RCW CONTAINS THE LENGHT OF THE RECORD PLUS ITS OWN LENGHT OF 4. THE
BCW CONTAINS THE TOTAL LENGHT OF THE RCWS AND RECORDS PLUS ITS OWN
LENGHT OF 4.

THESE 4-BYTE WORDS (BCW OR RCW) ARE USUALLY IN THE OCTAL FORM. OUR COBOL
COMPILER (FAST/PHILON) DOES NOT SUPPORT 9 TRACK (OR IS NOT DOCUMENTED) AND I
HAVE FOUND NO OTHER SYSTEM UTILITY TO DUPLICATE THIS. I NEED YOUR
HELP / ASSISTANT / GUIDANCE.

If possible send replies both to the bboard and logsams. Time for us is short. 

Charley F. ?Ashley, US ARMY
-------

mchinni@pica.army.mil (Michael J. Chinni, SMCAR-CCS-E) (10/21/89)

Charley,

	If the Unisys has a C compiler, you should be able to write a C program
to read and interpret the RCW and BCW. C allows you to read in an octal value.

	The thing to be carefull of is how you open the tape device. I suggest
reading the on-line manual entry on mt probably in section 7 (i.e. man 7 mt )
for a BSD-type system.

	If you get real lucky, someone will have already written something like
this and had it put in the archive of public-domain unix-sources.

/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
			    Michael J. Chinni
      Chief Scientist, Simulation Techniques and Workplace Automation Team
	 US Army Armament Research, Development, and Engineering Center
 User to skeleton sitting at cobweb   () Picatinny Arsenal, New Jersey  
    and dust covered workstation      () ARPA: mchinni@pica.army.mil
      "System been down long?"        () UUCP: ...!uunet!pica.army.mil!mchinni
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/

mike@BRL.MIL (Mike Muuss) (10/21/89)

There are several aspects to your problem:

1)  You should have your mainframe system write "export tapes" in a
fixed-blocked (RECFM=FB) or unblocked (RECFM=U) format;  using
variable-blocked or variable-blocked-spanned records for "export" to
another system makes for lots of extra trouble.

2)  Often, the easiest way to process foreign tapes on a UNIX system
is to read them onto disk, using the "DD" program, and the **raw**
tape drive interface (often called /dev/rmt0).  You can be certain
that the tape drive interface is RAW if the first character output
by "ls -l" is the letter "c", (eg, "crw-rw-rw- ...").
Once you have the data on disk, usually a small "C" program can
unravel things.  That kind of data handling in COBOL or FORTRAN
will be very painful, compared to using C or PASCAL.

If you need more help, contact your local Information Systems Command
(ISC) detatchment;  ISC is busy doing to the Army's computer systems
what they did to the Army's telephones.

	Best,
	 -Mike

davidsen@crdos1.crd.ge.COM (Wm E Davidsen Jr) (10/23/89)

  When we converted from Honeywell to other machines we just broke up
the tape with software. I assume that either your harware doesn't let
you read the individual records off the tape or you have to do it in
COBOL (which you mentioned). If you're in a hurry write a couple of line
C program to do the job. We did several thousand tapes a few years ago.

-- 
bill davidsen	(davidsen@crdos1.crd.GE.COM -or- uunet!crdgw1!crdos1!davidsen)
"The world is filled with fools. They blindly follow their so-called
'reason' in the face of the church and common sense. Any fool can see
that the world is flat!" - anon