There are a number of subroutines which can be called from FORTRAN to handle GRIB and BUFR products in an unblocked binary file. These routines skip over any padding bytes between products such as those present in data files retrieved from the ECMWF Mars archives.
Debug output can be triggered from the PB routines using the environment variable PBIO_DEBUG (set to 1,2,..).