B, o, and z (boz) edit descriptors

For a long time, the b, o, and z edit descriptors have been available for integer values. In the course of time, they have been extended to handle real and complex values too, and, in Fortran 2023, also the enum and enumeration types.

My question is, has anyone ever used this feature for any purpose (other than with integers).

Many thanks,

Mike Metcalf

For non-integers no. For integers I’ve used it to read the CFD and FE grid data files generated by one of the FLUENT (if I remember correctly) grid generators that stores the integer connectivity data for the grid as hex data. Took me several minutes of looking at an example file to realize all the funny looking data that I thought was binary was just hex data.

I use b and z edit descriptors for real values fairly often when trying to debug floating point code. When some weird thing happens with convergence, or division by a subnormal, or other things like that, then looking at the bit patterns rather than the decimal representation is sometimes the easiest way to understand it. The workaround, if not supported by your compiler, is to use transfer() to convert the bits to an integer, and then write that. That isn’t too bad, but the new convention makes that a little easier.

1 Like

ditto for b; easier than looking at spacing, floating-point conditioning of data and such to just look at the binary values. In the past in several projects we had ASCII data otherwise; but some float values we wanted to transfer between programs We used z formats to get bit-per-bit transfers between the programs.

But transferring binary files between platforms used to be difficult, which it rarely is now.

We used to also do our own equivalent of uuencode or base64 conversions which used Z format to convert
binary files to ASCII because those commands were not on most platforms and not nearly as easy as just using Fortran which was on everyone at the time. Today, moving the binary more directly is
usually not much of a problem.

If I remember right we had to equivalence the data to an integer array. I do not think transfer() existed at the time. The file generated was bigger than base64 would generate but the Fortran Z format was far more ubiquitous at the time and required no other infrastructure other than a Fortran compiler.

We used it from inside programs that way, but also had a tool that would encode any file. There were no stream files in Fortran but we opened the file as a direct access file with one-byte wide records and it worked much like a stream for our purposes.

Historical trivia: The original matlab program (written in FORTRAN) used the Z format for the save and load commands.