ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Limit the number of records in a subfile

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

  • Limit the number of records in a subfile

    I will begin with I am totally new to the subfile world and the best part is I'm doing it in COBOL. (Yeah). The only book I have is "Programming Subfiles in COBOL/400" by Jerry Goldson. The book is from the nineties. I want to know how can I limit the number of records in a subfile. I only want to allow the user to see a maximum of 50 records with 10 being displayed on each screen. I would appreciate any help I can get.
    Thanks,
    John
    John M. Mauro
    Software Engineer
    nThrive

  • #2
    A simple method would be to check a counter when you load your subfile.

    Comment


    • #3
      Terry,
      I tried the implementing a counter on the RRN here:

      IF WS-SUBFILE-RRN > ZERO AND <= 50

      THEN MOVE WS-SUBFILE-RRN TO SUBFPAGE OF DSPFMTC-O

      SET INDICATOR-ON (SFL-Display) TO TRUE

      IF WS-SUBFILE-RRN > 50

      THEN SET INDICATOR-ON (SFL-Display) TO TRUE

      SET INDICATOR-ON (SFL-End) TO TRUE

      END-IF

      END-IF.

      When this gets executed, I can no longer page up or down and it seems to freeze.

      Any other suggestions?

      Thanks for taking the time to look at my problem.

      John

      John M. Mauro
      Software Engineer
      nThrive

      Comment


      • #4
        Sorry, I tried to align the code logistically, but it ngnored my spaces
        John M. Mauro
        Software Engineer
        nThrive

        Comment


        • #5
          Unfortunately, that's not really enough code to understand what's going on ;-)

          If your "freezing" up...that tells me your in some sort of loop condition and I can't tell from the code snippet whether you exiting your loop...or not.

          My guess is that you need to look at your "loop exit" conditions to get the bigger picture. Can you post more code - or feel free to send it to me offline.
          Last edited by Terry Wincheste; May 16, 2017, 11:43 AM.

          Comment


          • #6
            Originally posted by johnmauro View Post
            Sorry, I tried to align the code logistically, but it ngnored my spaces
            As a web interface, the displayed pages are based on HTML so white-space is generally ignored. In order to override that, either click the 'Code' button ("#') in the 'Advanced' editor and insert code between the tags or insert code, select inserted code and then click the 'Code' button. (Or manually type the tags.)

            If you're counting subfile rows, the counter should be good for comparing to (50). But as mentioned, a little more code seems needed. However, it looks as if the test IF WS-SUBFILE-RRN > 50 test can never be true because it's nested inside the IF WS-SUBFILE-RRN > ZERO AND <= 50 test.
            Tom

            There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

            Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?

            Comment

            Working...
            X