A common technology stack for line of business applications in the sixties and seventies was IBM COBOL with the IMS database. I'm curious about how the combination handled record definitions.
COBOL has a COPYBOOK facility:
00001 * TRAIN6 EXAMPLE COBOL COPYBOOK
00002 01 MASTER_REC. COL 73-80
00003 05 ACCOUNT_NO PIC X(9). COL 73-80
00004 05 REC_TYPE PIC X. COL 73-80
00005 05 AMOUNT PIC S9(4)V99 COMP-3. COL 73-80
...
which seems straightforward enough. Presumably it must also have some equivalent of #include
or import
so that many COBOL programs can share a single COPYBOOK definition instead of having to repeat it.
IMS must also have had a record definition facility, and indeed there is an example of usage in https://share.confex.com/share/125/webprogram/Handout/Session17764/SHARE_Orlando%20DDL%2017764.pdf
CREATE TABLE table_decimal (
r_number INT INTERNALNAME RNUM,
ll SHORT INTERNALNAME LL,
c_decimal DECIMAL(7,2) INTERNALNAME CDEC,
FOREIGN KEY REFERENCES table_root
) IN COGDBD.COGDATA
INTERNALNAME TDEC
MAXBYTES 10
MINBYTES 6
INSERT LOGICAL
DELETE LOGICAL
REPLACE LOGICAL
AMBIGUOUS INSERT HERE;
There is some syntax overlap with SQL. I'm not sure whether that's because IMS DDL is an ancestor of SQL, or because some of the latter was retrofitted to a later version of the former.
But how was the combination handled?
If a COBOL program tried to read an IMS table, but the two were using different record definitions, would there be a runtime check for metadata compatibility, and a crash with an error message? Or would the COBOL program just misinterpret the stream of bytes, giving garbage results?
And how was maintenance handled? Did programmers have to keep the COBOL and IMS record definitions in sync by hand, or was there an automatic way to generate one from the other, or both from some third format?
COPY
statement. That is, after all, where the copybook gets its name from :-)