next up previous contents index
Next: Coding Zebra user Up: Technical details Previous: FZ control bank

ALFA exchange format

To allow files in exchange mode to travel on networks which cannot handle binary file transfer, a conversion to and from card-images is provided. This uses a sub-set of the 64-character ASCII set to represent the binary contents of a file in exchange file and data format.

The easiest way, from the coding point-of-view, would be to generate a hexadecimal dump of the binary file. But this is too simple in several respects:

File format

The file produced or expected by FZOUT/FZIN in 'ALFA mode' consists of card-images of 80 columns exactly, written by FORTRAN formatted WRITE statements. Column 1 of all lines is blank, except for the first and the last line representing the start and the end of an original physical record. Blocking, if any, is under control of the user with the JCL. On an IBM the character set is EBCDIC, on a CDC Display code, on most other machines it is ASCII. Translation, if any, is expected to happen in the network stations. Such files are not written to tape.

Number representation

An original 32-bit binary word is unpacked onto seven 5-bit bytes:

      I(1) = bits 31,32
      I(2) = bits 26 -> 30
          ...
      I(6) = bits  6 -> 10
      I(7) = bits  1 ->  5

In general this word is represented by 7 characters:

The first character C(1), called the type-character, combines the information I(1) with more information about possible shortening of the representation.

The remaining 6 bytes I(j) are translated into the characters C(j) whose CETA values are I(j)+1:

      value  0 1 2 ... 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
      char.  A B C      R  S  T  U  V  W  X  Y  Z  0  1  2  3  4  5

Small integers contain several leading bytes of value zero (or 31 for negative integers), the number N of such bytes is encoded into C(1), and the characters C(2 to N+1) are not output. A similar scheme is applied to words with trailing bytes I(j to 7) of value zero.

Very small positive integers, with value less than 10, are given a one character representation, and the encoding for C(1) is arranged such that the integers 0 to 9 stand for themselves.

The construction of C(1) is shown by this figure:

       I(1)  ooooo 11111 22222 33333 ooooo oooooooooo 33333
       I(2)  xxxxx xxxxx xxxxx xxxxx ooooo oooooooooo -----
       I(3)  xxxxx xxxxx xxxxx xxxxx xoooo oooooooooo x----
       I(4)  xxxxo xxxxo xxxxo xxxxo xxooo oooooooooo xx---
       I(5)  xxxoo xxxoo xxxoo xxxoo xxxoo oooooooooo xxx--
       I(6)  xxooo xxooo xxooo xxooo xxxxo oooooooooo xxxx-
       I(7)  xoooo xoooo xoooo xoooo xxxxx o123456789 xxxxx

  main type  1     2     3     4     5     0          6
   sub-type  01234 01234 01234 01234 01234            01234

  type-code              11111 11111 22222 2222333333 33334
             01234 56789 01234 56789 01234 6789012345 67890

 type-char.  ABCDE FGHIJ KLMNO PQRST UVWXY 0123456789 +-*/(

'x' stands for any value not zero, except in Main type 6 where '-' stands for a value of 31, and where 'x' stands for any value not 31.

One can see that main types 1 to 4 cover the general case and also shortening for trailing zero bytes. Main types 5 and 6 cover positive and negative short integers, very small positive integers have main type zero.

Compression of sets of consecutive identical numbers

This is done by following the first number of the set by the special character '=', not a member of the ordinary type-characters A to Z, 0 to 9, + to (, followed by the short integer N (represented like all other integers). This signals to the reading program that the last number has to be repeated N+1 times.

Examples:

    XBA=YU   XBA and YU are the small integers 32 and 20,
             hence this stands for 22 words containing 32.

    /45=9    /45 and 9 are the small integers -33 and 9,
             hence this stands for 11 words containing -33.

    0=XMO    0 and XMO are the small integers 0 and 398,
             hence this stands for 400 words of all zeros.

This surely is unreadable, but it is not meant for the human eye.

Non-repetition of identical type characters

If a set of consecutive numbers all have the same type character, the first number is preceded by the special character '[', the type is omitted for all numbers except the first, and the last number is normally followed by the special character ']' (the characters '[' and '=' also terminate a set of same type-characters).

Example:

   [XBA MO MP MQ  [YU  V  W  A  B  C  X  Y  Z  0  1  2  3  4  5]

represent the numbers

    32 398 399 400 20 21 22  0  1  2 23 24 25 26 27 28 29 30 31

(the blanks are typed for readability, they are not present on the file).

Start and End of physical record

The first line of the dump of each physical record carries the special character '>' in column 2, normally also in col. 1. Column 3 of the first line has '0' or '1' if the record is a fast or a control record. The last line carries the symbol '<' in column 1. The last number of the record, normally on the last line, is followed by '<', followed by the two check-sum numbers. The check-sums are obtained by addition, separately for bits 17 to 32 and bits 1 to 16, of the binary value of each number written. A second '<' could be given instead of the 2 check-sum numbers to suppress the check.



next up previous contents index
Next: Coding Zebra user Up: Technical details Previous: FZ control bank


Janne Saarela
Mon May 15 08:34:47 METDST 1995