For various reasons, I find myself needing to learn some COBOL. I have a question about key fields when using the "START" statement. When I compile my program using this START:
I get the following message in the compile:
Now the SV-* fields are defined with the exact same attributes as the key fields in the file (they are all 3 character). My program produces no output when START is specified like this.
When I changed this to:
I don't get the previously mentioned message in the compile and the program produces the output I expect. The only difference between the two is the TI* names come from WFTINL09. This tells me that you have to use the names of the key fields from the database file when using START? Being an old RPG guy, I'm used to using whatever field names I want, as long as the field matches the attributes of the file's key fields.
Code:
START WFTINL09 KEY IS EQUAL TO SV-LDWHS, SV-LDASLE, SV-LDBAY, SV-LDLVL INVALID KEY SET WFTIN-END-OF-FILE TO TRUE.
Code:
MSGID: LNC0635 SEVERITY: 20 SEQNBR: 004601 Message . . . . : Keys specified do not match externally-described keys for file 'WFTINL09'. KEY IS phrase ignored.
When I changed this to:
Code:
MOVE SV-LDWHS TO TIWHS. MOVE SV-LDASLE TO TIASLE. MOVE SV-LDBAY TO TIBAY. MOVE SV-LDLVL TO TILVL. START WFTINL09 KEY IS EQUAL TO TIWHS, TIASLE, TIBAY, TILVL INVALID KEY SET WFTIN-END-OF-FILE TO TRUE.
Comment