0

I'm having an error shown as in the picture below :

Error

If I enter blank option or wrong option, I will get the error as above

enter image description here

When this error occur, I cant Update, Delete and Refresh.

It happens when I want to update existing record and also when I put wrong option and blank option. When I debug, I realize that the error comes when want to UPDATE SUBFILE.

OSR     Begsr
        ReadC    SFL01
        DOW      *IN91 = *OFF
        
        Select
OPT     WhenEQ    2
        Exsr      UPDSR
OPT     WhenEQ    4
        Exsr      DLTSR             
OPT     WhenEQ    5
        Exsr      DSPSR
        Other
        Exsr      ERRSR
        EndSL

        Clear            OPT

        UPDATE    SFL01
        READC     SFL01

        Enddo
        Endsr

What should I do? Do I need to chain from logical file before UPDATE SUBFILE? Please help me. Thanks in advance

6
  • you have to successfully read the subfile record before updating it. You should post some code to get help on what the actual error is. Commented Jun 11, 2021 at 4:17
  • Hi, I already update my question Commented Jun 11, 2021 at 4:48
  • why use the old style RPG? Only takes a few minutes to convert to RPG free format. Commented Jun 11, 2021 at 17:06
  • your error says AGN5D, I assumed that was your DB file. But you say the error is when updating the Subfile? Commented Jun 14, 2021 at 18:52
  • AGN5D is my display file. I got the error when I want to update, or even if the option are blank and press enter after that will get the same error. Commented Jun 14, 2021 at 23:35

2 Answers 2

1

You should show the error as text, not include a link to a picture.

Also give the error ID, CPFxxxx not just the description.

The message is pretty self-explanatory, and you can find out even more details in the second level message text. (Hit F1 on the message if an active job or look at the joblog if the job has ended.)

Your UPDSR or DLTSR is doing an UPDATE or DELETE op-code without first reading the record via CHAIN.

Sign up to request clarification or add additional context in comments.

Comments

0

the indicator *in91 has to be specified as the EQ result indicator of the READC statement. Both READC statements. Or, replace the test for *in91 with a test of the built in %eof variable.

c     OSR           Begsr                                               
c                   ReadC     SFL01                                  91 
c                   DOW       *IN91 = *OFF                              
** ------------------------- osr_eof -----------------------
c     OSR_eof       Begsr                                   
c                   ReadC     SFL01                         
c                   DOW       %eof = '0'                    
                                                            
c                   Select                                  
c     OPT           WhenEQ    2                           
c                   Exsr      UPDSR                         
c     OPT           WhenEQ    4                           
c                   Exsr      DLTSR                         
c     OPT           WhenEQ    5                           
c                   Exsr      DSPSR                         
c                   Other                                   
c                   Exsr      ERRSR                         
c                   EndSL                                   
                                                            
c                   Clear                   optn            
                                                            
c                   UPDATE    SFL01                         
c                   READC     SFL01                         
                                                            
c                   Enddo                                   

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.