ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Program error

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Thanks, but what about the case if 'SETLL 1 FILE2' here file2's first key field value is for example defined with character data type with 70 length?



    Thanks..

    Comment


    • John192
      John192 commented
      Editing a comment
      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 ?


      Thanks..

  • #17
    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.

    Comment


    • #18
      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

      Working...
      X