SUBFILE – To read only the UNCHANGED RECORD

320 pts.
Tags:
AS/400
AS/400 Subfiles
Hi, please help me with the logic how can I read the subfile when the record is not changed. (The user did not touch or crossed the subfile of particular record). How can I deal with that?
After searching, I came to know we can achieve only with SFLNXTCHG keyword. But I don't how to proceed with the code in my program.
SriVijay
1

Answer Wiki

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

Hey SriVijay,

General use of SFLNXTCHG indicator is to mark the record as changed.
Mostly it will be used in combination of READC (Read Changed Records) to enable multiple validations on selected options.
But,
In this case, you can switch ON SFLNXTCHG indicator before writing record to Subfile.
Pradeep.

Discuss This Question: 11  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.
  • hunshabbir7
    Another option is to manually loop through sub file and read records (which are not changed or changed). While writing records in subfile you can increment counter which have total records in sub file at the end. Then you can loop upto that counter and manually read records in subfile.
    2,900 pointsBadges:
    report
  • srivijay1
    Can you pls explain in brief. Do i want to check the condition after doing READC if record is changed i will update with prefix SFLNXTCHG ON and After update i will make it OFF then in else part do i want to check for the Non changed record?
    320 pointsBadges:
    report
  • srivijay1
    Hi hunshabbir7, Are you telling to check with two readc loop to check the subfile records?

    320 pointsBadges:
    report
  • hunshabbir7
    Its simple. When you are populating subfile then you increment a counter flag to count total number of records in subfile. Then in the function where you want to iterate through subfile simply apply DOW or DOU loop from 1 to total_counter and Chain through subfile by passing RRN (keep increment). From the logic below I think you can understand.


    Pseudo 

    a= 1
    b = total records in subfile

    a   doweq   b

    chain  a  subfile
     if %found()
    //do your logic
     endif;

    a++;

    enddo 


    By this either records are changed or not you will be able to iterate through all subfile.
    2,900 pointsBadges:
    report
  • ToddN2000
    You want to read in only the records that have not been changed?
    Seems like a strange request, but have you tried reading the subfile in a do loop by RRN and skipping the records that have the SFLNXTCHG turned on?
    129,900 pointsBadges:
    report
  • srivijay1
    Thanks you  hunshabbir7 i got good idea from you . Will try and let you know.
    320 pointsBadges:
    report
  • srivijay1
    Hi ToddN2000 Yes i tried to use opcode Readc for the changed record, and in else part i am checking and doing my logic to get unchanged record with another ReadC. But its seems not to read the file twice in single loop.

    So i am looking for some other good logic to implement.

    320 pointsBadges:
    report
  • ToddN2000
    Do a chain on each by RRN to process the subfile. A READC will only read the changed records. It ignores the unchanged records like they do not exist. The else in your case would mean there are no more changed records to read.
    129,900 pointsBadges:
    report
  • 22917

    Hi,

    I have done Input Subfile as follows

    SFLINZ:

    1. SFLCLR - ON

    2. Write Subfile Control record format

    3. SFLCLR - OFF

    4. RRN =  0

    SFLLOD:

    5. SFLINZ - ON

    6. SFLDSPCTL - ON

    7. SFLDSP - ON

    After entering invalid data to the subfile, error is thrown. Without correcting the invalid data, if i enter any valid data, it is processing without considering the invalid data in the screen, as readc is reading only the changes records.

    I am not handling rrn here anywhere. So please tell me how to proceed.

    560 pointsBadges:
    report
  • hunshabbir7
    Please begin new thread for your question.
    2,900 pointsBadges:
    report
  • 22917

    I am using Input subfile technique to create the save file with the objects entered in the screen. Here first i am displaying the empty screen to enter objects. Validating the objects entered to the screen. When invalid objects entered i need to throw the error to correct it. Here when i enter valid objects without correcting invalid object, it is processing. This should not happen. I hope sflnxtchg is not helpful. While loading the empty subfile, i m just making SFLINZ indicator on, not incrementing RRN for input subfile.Suggest me your thought on this.

    560 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.

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

Following

Share this item with your network: