ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Cpf501b

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

  • Cpf501b

    Hello,

    I have a pgm doing a delete, it receives the error CPF501B, but I don't know why...


    Dcl-f mrsrcscanf usage(*Update:*Output:*Delete) KEYED RENAME(MRSRCSCANF:SCANF) ;
    DCL-f mrsrcscand Workstn Indds(Indicators);​
    Begsr Dltrecord;
    Exsr Setmode;
    DOU Not %found(mrsrcscanf);
    CHAIN ENTRY MRSRCSCANF;
    delete scanf;
    enddo;

    If Not Dlterror;
    Exfmt LISTMNT;
    Reset Action;
    Exsr resetdata;
    Endif;
    Endsr;​


    Begsr resetdata;
    reset ENTRY;
    Endsr;​

  • #2
    The CHAIN and DELETE appear to be referring to separate record formats. So the CHAIN is not locking the record that you are running DELETE on.

    Comment


    • #3
      You don't check if the chain fails before trying to delete the record.


      You could change the code to this:

      DOU Not %found(mrsrcscanf);
      delete ENTRY scanf;
      enddo;​

      Comment

      Working...
      X