If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.
I mean in that case how will we position to cursor to the first record if file2's first key field is not numeric ?
and if I wish to position the cursor to the second ,third ,last record or to any nth position then if first key field is numeric and non numeric in both the cases then ?
If FILE2 is declared without the 'keyed' keyword then the file's key field(s) won't be used when the SETLL operation executes.
If FILE2 is declared with the 'keyed' keyword and the file's first key field is a 70-character field then you get the following error during compilation:
RNF7077 "Factor 1 literal is not the same type as first key field in file"
Statement "SETLL *START FILE2" can be used to position to the start of the file (not quite the same thing as "the first record").
As far as I know, RPG IV doesn't give a way to position to the second/third/etc. record of a file that's defined as 'keyed'. You have to read one less than the required number of records (using READ or READE operations) in order to achieve that.
The compile listing has a section where it lists the data types of the keys for the file. Look for "K e y F i e l d I n f o r m a t i o n" in the listing.
Comment