Copybook and COMP date


I was asked to take a COMP(3) date (compressed for storage by the mainframe) from a record and write it out to the screen to see if it was the correct date. Each record has many fields–some of which are currently being ignored and skipped with #filler variables.

I tried adding in a new variable in the location following one of the existing variables (in the position where it exists in the record) with a Type P and a length 7. I then changed the old filler to length 3 (which used to be length 11). I saved the copybook and exited the library.

Then I did a write of the variable in the Natural program file. WRITE #TDW-DATE. When I did a STOW it said that the variable was not declared or was not indexed correctly (or something of the sort–I am trying to remember this error from earlier today and I am now at home).

I hope someone can help me!


If P7 is seven bytes long, shouldn’t the 11 byte filler become 4 bytes after redefinition?

If the fields were all alpha, then you would be correct. I suspect what Amy has is a P11 redefined into a P7 and P3, which is correct. P11 is 6 bytes long, and P7 is 4 bytes long leaving 2 bytes, which just fits a P3 field.

Who makes ‘filler’ packed fields ?

Thank you for the info. I haven’t had time to work with Natural since my last post. I am going to pull down an old COBOL book and look at variable declarations, since I believe that they are similar to Natural.

I don’t know much about any of this, since I am coming from a C/UNIX background (and I haven’t worked for 8.5 years!) I am sure that I can easily mess up the filler lengths.

Thank you for answering!