|
Mike Silvers wrote: > > OK. It is Friday -- finally. I am having a problem with something that > should be simple! What I am doing is reading a file into a DS. I am > getting a compiler error that tells me that the data structure is not > allowed in the operation. My code is as follows: > > FPRJ001L5 IF E K Disk ReName(PRJ001R:PRJ001R5) > F Prefix(L5:2) > D PRJ001R5DS E DS ExtName(PRJ001L5) > D Prefix(D5:2) > /Free > read prj001R5 PRJ001R5DS; > > The error is: > *RNF7701 30 347 010500 Data structure PRJ001R5DS is not allowed for the > operation. > Mike, whenever you don't understand a compiler error message, try recompiling with OPTION(*SECLVL). Then you can see the message help in the message summary. Message . . . . : The data structure is not allowed for the operation. Cause . . . . . : For operation codes CHAIN, READ, READC, READE, READP, READPE, and UPDATE, the data structure does not consist of the input fields of the specified file. For operation code WRITE, the data structure does not consist of the output fields of the specified file. The data structure is ignored. Recovery . . . : For an input operation, define the data structure using keyword LIKEREC, with the record name as the first parameter and *INPUT as the second parameter. For output operations, code *OUTPUT as the second parameter of LIKEREC. Compile again. FPRJ001L5 IF E K Disk ReName(PRJ001R:PRJ001R5) F Prefix(L5:2) D PRJ001R5DS DS LikeRec(PRJ001R5) /Free read prj001R5 PRJ001R5DS; // PRJ001R5DS is qualified, so you would access PRJ001R5DS.fld1, // PRJ001R5DS.fld2 etc.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.