In the ecCodes Fortran 90 interface the information contained in the GRIB message can be accessed through alphanumeric keys.
In your Fortran code, you will have to explicitly name the keys that you are using. The tables below will help you find the key names corresponding to the "old" GRIB1 header section elements.
These tables include the ecCodes Coded key names and also Recommended key names. You should use the latter.
Find the corresponding ecCodes key names to the elements in the GRIBEX ksec0(*), ..., ksec4(*), psec2(*),...psec4(*) header sections.
For more info see: KSEC0, KSEC1, KSEC2, KSEC3, KSEC4, PSEC2,PSEC3, PSEC4
Try to use the "recommended" keys, i.e. keys that are valid for both GRIB edition 1 and GRIB edition 2 (for instance "dataDate" instead of "YearOfCentury", "month", "day").
See edition independent keys under: https://apps.ecmwf.int/codes/grib/format/edition-independent/