How to implement find utility in a load all subfile

20 pts.
Tags:
AS/400
AS/400 search
AS/400 Subfiles
Hi,

I have a load all subfile in which i want to add search utility so that user can give a specific value at the top right of the screen and see the specific recerod.I mean subfile display should show the page starting by the record which he/she searched for..Any idea please

Thanks in Advance

Bikram

Answer Wiki

Thanks. We'll let you know when a new response is added.

Hi,

i understood as if u need to display the search value at the top of the search record?

For instance let us assume that there is a search column called EMPNO, So when the user types the EMPNO, that particular value will be dispalyed.

Remember EMPFILE should be Keyed on EMPNO, Then Start reading the EMPFILE from the beginning , and when the search value exists , SETLL the EMPNO with the search value and load the files using Load all, I hope i would have solved the problem.

If i am wrong correct me.

The best way to handle this is by using embedded SQL to load your subfile. When someone types search criteria in on the screen, you can rebuild your SQL statement with a where clause searching for the criteria entered on the screen.

http://www.oneworksinc.com/qanda/how-to-implement-find-utility-in-a-load-all-subfile/

Discuss This Question: 5  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Vatchy
    The only way I can see this working is by saving the search field and it's RRN to an array as the subfile is being loaded. That way you can look up the search field in the array and set the subfile RRN to that particular RRN.
    1,410 pointsBadges:
    report
  • philpl1jb
    you can loop through the subfile until you find the record desired RRN = 0; <-- this would be the same type size as the Subfile record pointer DOw SFLFld < Request and RRN < current subfile size RRN += 1; RRN Chain SFL1 <<-- this would be the subfile record name EndDo if SFLFld < Request REC# = RRN <<-- REC# is the field for SFLRCDNBR Endif
    50,205 pointsBadges:
    report
  • OneWorks
    The best way to handle this is by using embedded SQL to load your subfile. When someone types search criteria in on the screen, you can rebuild your SQL statement with a where clause searching for the criteria entered on the screen.
    55 pointsBadges:
    report
  • Splat
    It depends on the type of subfile you're using. If it's a load-all subfile, you'd either need to rebuild it each time (see OneWork's comments) or read through the subfile to find the matching value. If it's a single page subfile, (SFLSIZ = SFLPAG), you can either use SQL or SETLL to position the file (SETLL would require the search field be a key field). Lot's of options.
    7,305 pointsBadges:
    report
  • DanTheDane
    Firstly I agre with OneWorks. Secondly: 'load all' file - assuming that you have a loop controlling the 'read record and display as SFL-line', I read your requirement as you have the need to 'qualify' which records are to be displayed according to entered search/qualify-criterias. If this is the case, simply add an 'exsr subqualify' statement in the loop, and create a subroutine 'subqualify' subroutine, where the actual qualification (if's ) takes place. Return an indicator ex 'qualified' which tells the loop-proces if the record is going to be displayed as part of the SFL. Here is some pseude-code to clarify:
    *loval setll myfile;
    read myfile;
    dow not %eof;
    exsr subqual;
    if qualified;
      write record to sfl:
    endif;
    ==========
    begsr subqual;
    if recfield1 = searchfield1;
      qualified = '1';
    else;
      qualified = '0',
    endif;
    endsr;
    read myfile;
    enddo;
    
    I often program this kind of solution into old application-code, and I always isolate the actual qualification-test in a subroutine, because it sometimes tend to be quite advanced with 'like'-functionality a.o. happy coding. DanF
    2,555 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following