ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Record existence without readng a file?

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

  • Record existence without readng a file?

    I want to check for the existence of record, without reading the file. I want to use file information DS for this, how to do?

  • #2
    Re: Record existence without readng a file?

    Well declare the DS and then check the respective position for retrieving the information. Its as simple as that.

    Also its probably better to get access to an AS400 to improve your knowledge since most of these things are better understood when actually used rather than people here telling what is usually done.

    Comment


    • #3
      Re: Record existence without readng a file?

      Is this a test question? In absolute terms it is not possible. If it is a keyed file a SETLL could be used to establish (non)existence - since the data is not retrieved it technically would not count as a read but ...

      It really would help if we knew why the heck you _want_ to do this.

      Comment


      • #4
        Re: Record existence without readng a file?

        I agree with Jon that it was a test question. The problem is that the question is not being asked correctly. The question has probably been passed from person to person a few times as to lose its original form, which is likely wanting an answer of using the setll and testing to see if the position-to is on the record equal to the search key arguement.

        I would hope an interviewer isnt asking this question and wanting some sort of SETLL answer, because it would be wrong. You cant check for the existence of a record without reading a file. You can check for the existence without retrieving the data, which is how the question was probably originally asked.

        Retrieving the relative record number in the file infds in conjunction with a setll would not be the correct way to do this, which sounds like the path the OP is going in. You cant check for the existence this way, as just because you get a rrn updated in the infds doesnt mean that the record you were checking for exists.
        Last edited by MichaelCatalani; June 10, 2011, 09:05 AM.
        Michael Catalani
        IS Director, eCommerce & Web Development
        Acceptance Insurance Corporation
        www.AcceptanceInsurance.com
        www.ProvatoSys.com

        Comment


        • #5
          Re: Record existence without readng a file?

          I understood the question as "checking for existence of records" and not "check for existence of a particular record".

          Would the relative record number field (position) in the INFDS retrieve the number of records in the file OR would it retrieve the record number at which the file pointer/cursor is positioned at? I always thought it was the number of records in a file.

          Edit: After a few searches, I found that the relative rrn position indicates the rrn after a record is read and not the number of records in the file...my bad . I should start going over the basics again instead of free-format, procedure pointers, etc
          Last edited by vikramx; June 9, 2011, 10:28 AM.

          Comment


          • #6
            Re: Record existence without readng a file?

            Wow ... I didn't realize we were back in school again. I guess it is about that time, eh? (Threw that in so my Canadian Forum-Mates could keep up... LOL)

            8-)

            Comment

            Working...
            X