It was relatively easy to figure out that the "0029" on the Heinz catsup bottle meant the product was bottled on Jan. 2, 1979. But the "4207" on the McCormick parsley was enough to stump a cryptographer.

Now, two Montgomery County women have taken some of the mystery out of grocery shopping.

Gloria Buckberg and Judy Doctor, in a new booklet called "Crack the Codes," explain how to decipher the secret dates stamped on food products at the time of processing -- and what those dates mean.

Dating information helps shoppers determine the freshness of packaged goods at the grocery store and on home pantry shelves. Once a product has exceeded its shelf life expectancy, it begins to deteriorate in quality and nutritive value.

The booklet lists the shelf life of many products -- as well as the instructions for decoding the product dates.

In the McCormick case, a shopper would have to add 5 to the first digit -- 4 -- to get 9, meaning that the tin can was packaged in 1979. Then divide the last three digits, 207, by 50 to get 4 and a remainder of 7.

The 4 tells the number of months before the one in which production occurs. Since January, February, March and April precede May, the McCormick parsely can must have been produced in May.

The remainder left over from the division, 7, represents the day of the month. So the exact date of production was May 7, 1979.

Should there be a fifth letter or number in the code, it would identify the crew that produced the product.

On the Heinz catsup bottle, the first three digits identify the day of the year from Jan. 1 (001) to Dec. 31 (365), and the last figure is the last digit of the year the catsup was bottled. The year 1979 thus would be identified as 9, and "0029" would be the second day of the year 1979.

Some manutacturers, instead of using production dates in their codes, print the last date that the product should be sold or the last day that it should be used before quality begins to deteriorate.

The secrets to the codes and used by about 40 companies are disclosed in "Crack the Codes," which was compiled by Buckberg, a community volunteer, and Doctor, a consumer specialist for the Montgomery County Office of Consumer Affairs.

"With the recent swift rise in food prices, it is increasingly important that consumers have full information on the foods they buy," Barbara B. Gregg executive director of the consumer affairs office, says in the introduction to the booklet.

Gregg said she favors "open dating information in plain language on food products." some manufactures, she said, have begun to do that.t.

But until easily understood dates are more widely used on foods, she said, the booklet will enable consumers to decipher the jumbled dates for themselves.

The booklet is free for Montgomery County residents, but costs 25 cents for nonresidents. Persons who want the booklet may obtain a copy by writing to the Office of Consumer Affairs, 611 Rockville Pike, Room 201, Rockville, Md. 20852.

Requests for the booklet must include an addresed envelope stamped with 20 cents postage and with a request for "Crack the Codes."

Mongomery County's booklet is the first of its kind for the metropolitan Washington area, according to the authors.

The concept isn't unique, however. The New York Consumer Protection Board and the Connectiuct Department of Consumer Protection, among other agencies, have offered booklets containing food coding information to constituents in their areas. Both those agencies assisted the Mongomery County authors, according to a note of acknowledgement in the booklet.

However, the Mongomery Country publication is distinct in its inclusion of code information on food brands that are more common in the Washington market than other areas, Doctor said. One example is Schindler's Peanut Products, a College Park-producer of packaged nuts. In addition, the booklet includes national brand decoding-tips.

"We have a cross-section of foods and brands in the booklet," she said. "You will find it contains most types of food that a family would buy during a weekly shopping trip to the supermarket."

Since the booklets became available last month, the consumer affairs office has distributed about 5,000 copies, most of them to local consumers.

"I buy food on sale and store it at home," said Januet Mullis, a Silver Spring resident. "Now, with this booklet, I can tell which product I should use first."

When she looked inside her pantry one day recently, Mullis found two boxes of Swansdown cake flour. The code on one was E8144e1.

Consulting her booklet, she translated the code to May 24, 1978.

"That means it was made May 24, 1978, so it is older than the other box (stamped B8279e1 -- Oct. 6, 1978)," Mullis said.

There is no uniformity about where a dating code can found.

They appear almost any where on containers. The Heinz catsup bottle is marked on its cap; the parsley tin, on the bottom.

Sometimes there is no discernible code at all. Bottles of McCormick spices, for instance, don't have any date code numbers. Instead, the label on the bottle may have a series of notches representing the year, month and day. The notches can be read only by a person with a McCormick decoding card. In some cases, the notches are removed before the bottles are shipped from McCormick's plant in Baltimore County, leaving no clues.

Dating codes can be confused with universal product codes, which consist of a series of lines and bars as well as a set of numbers. But the universal product code numbers, which are designed for computer checkouts, identify the product rather than the date of production.

Information for decoding the secret dates on food products was furnished by manufacturers. Of 53 companies asked to explain their codes, 40 responded the authors said.

The 13 companies that didn't respond to inquiries were Acme Markets Inc., American Home Products Corp., Beatrice Foods, California Canners and Growers, George A. Hormel & Co., Ocean Spray Cranberries Inc., Mrs. Paul's Kitchen, Pet Inc., Platners Peanuts, M. Polaner & Son, Rich Products Corp., Sunsweet Growers Inc. and Washington Flour.

Four companies responded but failed to include sufficient information to be in the booklet. They were Castle and Cooke Inc., Del Monte Corp., Hanover Brand Inc. and Procter & Gamble Co.

Six local supermarket chains also were contacted by the women during the nine months they were compiling information for the booklet. One chain, Super Saver supermarkets, never responded to the letter of inquiry.

Four other chains, asked to provide deciphers for 10 of their most frequently purchased coded products, either didn't answer the question or said that providing the information would be a very extensive process.