CPF5011 COBOL subfile error

260 pts.
Tags:
AS/400
AS/400 Subfiles
COBOL
I have not written a subfile program in a while, but am having trouble when errors are encountered. As this is COBOL and the code can be lengthy to weed through on a forum, let me first spell out the scenario. I have 32 records in a COBOL subfile, 11 per page. There is one input field per subfile record for the user to enter in a dollar amount. I am performing an edit routine to look for 2 possible errors in data entry – 1) Entry must be a positive number 2) Entry must not be more than a variable value. The variable value is computed and stored as a hidden field for each subfile record. I start reading the subfile at relative record number 1 and read until an error is encountered or until relative record number exceeds number of records in subfile. When I am testing the first record in the subfile, all is well. It is when I enter an invalid dollar amount in subsequent subfile records that I get the CPF5011 error. For example, if I enter an invalid dollar amount in the fifth record of the subfile – The amount field for the fifth record is appropriately “reverse-imaged”, but there are 5 records in my message subfile at the bottom of the screen instead of one. The first 4 errors seem to relate to the first 4 (unchanged) records of the subfile CPF5011 Do change to subfile by GET for file XXX0166 in library TESTLIB. CPF5011 Do change to subfile by GET for file XXX0166 in library TESTLIB. CPF5011 Do change to subfile by GET for file XXX0166 in library TESTLIB. CPF5011 Do change to subfile by GET for file XXX0166 in library TESTLIB. then my expected error message is next – “Amount exceeds xxxxx limit” Cause text for CPF5011 reads, “Changes were not done before GET. Check the previous operation.” Recovery text for CPF5011 reads, “Change the sequence of operations in program. Compile again. Try the command again.” Is anyone familiar with CPF5011?

Software/Hardware used:
AS/400 COBOL

Answer Wiki

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

Discuss This Question: 6  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
  • TomLiotta
    What do you mean when you say "I start reading the subfile at relative record number 1..."? That is, please show the COBOL READ statement that you use. Also, please show the statement that puts the subfile error indicator back out to a subfile record. . What does the SELECT statement look like for the subfile? . It might be difficult without seeing the logic of the code that does the subfile I/O. We don't need to see the validation code; that can be in a PERFORM subroutine. But the logic that loops through the subfile reading changed records (or all records) and rewriting subfile error indicators might be necessary. . Tom
    125,585 pointsBadges:
    report
  • LetItBe
    What do you mean when you say “I start reading the subfile at relative record number 1…”? That is, please show the COBOL READ statement that you use. MOVE 1 TO RELATIVE-NUMBER PERFORM 30000-EDIT THRU 39999-EXIT UNTIL RELATIVE-NUMBER > SUBFILE-CNT OR ERRORS-EXIST. ---------------------------------------------------------------------- 30000-EDIT. IF NO-ERRORS READ SUBFILE XXX9999-FILE INTO SFL9999-I FORMAT 'SFL9999'. IF NO-ERRORS IF SHOULDB OF SFL9999-I < 0 MOVE 'Y' TO ERROR-SW MOVE TURN-ON TO IN40 MOVE CORR SFL9999-I TO SFL9999-O REWRITE SUBFILE XXX9999-RECORD FROM SFL9999-O FORMAT 'SFL9999' MOVE 'MSG1111' TO MSGID PERFORM XXXXX-MSG ELSE MOVE TURN-OFF TO IN40 MOVE CORR SFL9999-I TO SFL9999-O REWRITE SUBFILE XXX9999-RECORD FROM SFL9999-O FORMAT 'SFL9999' END-IF END-IF. ADD 1 TO RELATIVE-NUMBER. Also, please show the statement that puts the subfile error indicator back out to a subfile record. . What does the SELECT statement look like for the subfile? SELECT XXX9999-FILE ASSIGN TO WORKSTATION-XXX9999 ORGANIZATION IS TRANSACTION ACCESS IS DYNAMIC RELATIVE KEY IS RELATIVE-NUM CONTROL-AREA IS SCREEN-CONTR FILE STATUS STATUS-CODES.
    260 pointsBadges:
    report
  • LetItBe
    To paraphrase Scarlett O'Hara, Today IS another day...to arm wrestle my subfile... I have partially solved my problem getting rid of the CPF5011 error. In wanting to reset the error condition (reverse image) I was rewriting the subfile record with the indicator turned off whenever the negative amount error was NOT found. I deleted that bit of code with the following resulting scenario - Entered negative amount on subfile record #3. Reverse image and expected error message display (without additional CPF5011!). Then, corrected subfile record #3 to valid positive amount and entered negative amount on subfile record #5. Reverse image remained on corrected subfile record #3 and reverse image on subfile record #5 with expected error message. So I still need to reset my reverse image indicator when correction is made to a subfile record that was previously in error. But how to do that without rewriting the subfile record every time a record is read... I'm off to try and reset reverse image indicator and rewrite only for subfile record that was in error previously...
    260 pointsBadges:
    report
  • TomLiotta
    Is there a reason you do your edits by reading via RRN instead of with READ SUBFILE NEXT MODIFIED? After edits are clean, you could then read straight through sequentially to do whatever your database or other output will be. -- Tom
    125,585 pointsBadges:
    report
  • LetItBe
    Tom - There is not a good reason. But since something with the rewriting of un-modified subfile records caused me problems here, I would like to try the read next modified in this and/or my next subfile adventure. I still don't fully understand why resetting an indicator and rewriting the subfile record created a problem, but IT DID, so I will not be doing that again. Thanks for your comments.
    260 pointsBadges:
    report
  • TomLiotta
    I don't have example code that uses straight RRN subfile code in COBOL. If I get time, I'll try to create a test. . But it shouldn't take more than a few minutes to change your code over. You shouldn't have to change anything but the single READ statement that you showed here; and when you do the REWRITE, you should set SFLNXTCHG on to mark it for re-edit. The rest of the code can be the same. . That is, I assume that you have a later PERFORM-loop that grabs the values after the editing is done. That would remain the same. RRN works fine for that. . I guess there's one extra possibility. Is it necessary to verify that every subfile record was modified by the user? Or is it only required that the test value is non-negative? . Tom
    125,585 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