In quite a few COBOL tutorials about file reading, I see that they use the READ fd INTO variable statement instead of the READ fd one. They have to code a duplicate structure format: one for the file definition and one for the variable following INTO (as I highlighted in yellow in the sample code).
I wonder why you need to allocate extra storage (the WS-EMPL) since you already have the buffer EMPLOYEE-REC. Maybe the read buffer is read-only and you would not be able to use its fields as the receiver of statements (like ADD 1 TO EMPL-ID would be illegal).
What would be the typical use-cases of using READ fd into var and duplicating storage with the exact same structure?
Q: What would be the typical use-cases of using READ fd into var and duplicating storage with the exact same structure?
Loading a table from a file.
Building a virtual record in memory containing data from multiple files, or, in some cases, from the same file where a primary record is followed by one or more related secondary records.
Historically, it was done for efficiency and may be retained for style.