10 pts.
 COBOL SubFile Processing
Hello All. I am sure that this question has already been answered somewhere but I am not able to find the answer so please bear with me. My DDS contains 4 records 1) MAP1 RECORD 2)MAP1S SFL 3)MAP1C SFLCTL 4) MAP1S MAP2 RECORD

Map1 contains fields that are used to filter the results to be displayed in the subfile. My program edits the subfile and if I find an error I want to position the cursor on the field in the subfile record that is in error. Problem is - the cursor keep positioning itself in MAP1 on the first entry field. What am I doing wrong?

Thanks in advance. Nancy



Software/Hardware used:
ASKED: May 25, 2011  5:28 PM
UPDATED: May 26, 2011  11:50 PM

Answer Wiki:
Try the SFLNXTCHG keyword, Here is a snippet from the IBM manual <pre> SFLNXTCHG (Subfile Next Changed) keyword for display files Use this record-level keyword on the subfile record format to force the work station user to correct program-detected keying errors in subfile records that have been read by the program. It does this by causing a record to be changed so that a get-next-changed operation must read the record as described in the following section. This keyword has no parameters. Subfile operations with SFLNXTCHG: A typical use of SFLNXTCHG could be as follows: A work station user changes some records in a displayed subfile (this could be for a data-entry application or a data-update application). After changing some records, the work station user presses the Enter key, and the program reads only the changed records with get-next-changed operations. (For example, READC in RPG III and READ-SUBFILE-NEXT-MODIFIED in COBOL.) If the program detects keying errors in the changed records, it can send update operations (UPDATE in RPG IV, REWRITE SUBFILE in COBOL) to the subfile records in error, setting indicators so that SFLNXTCHG is in effect during the update operations. These update operations are sent to the subfile record format. After all the records in error have been updated, the program sends an output/input operation to the subfile control record format to display the subfile again. With the subfile displayed again, the work station user types the data again and presses the Enter key. If the data is correct, the program does not display the subfile again. The records in error (and any other records changed by the work station user) are returned to the program on the next get-next-changed operation. This is because SFLNXTCHG caused the subfile records to be considered changed even though the work station user did not change them. This allows the program to prohibit the work station user from ignoring program-detected keying errors in subfile records. Subfile operations without SFLNXTCHG: If SFLNXTCHG is not specified, or is specified but not selected on the update operations to the subfile records, then the work station user can simply press the Enter key instead of correcting the program-detected errors. The program then reads no records because the get-next-changed operations find no changed records the second time the Enter key is pressed. Option indicators are valid for this keyword. You cannot specify SFLNXTCHG with the SFLMSGRCD keyword. Example: The following example shows how to specify the SFLNXTCHG keyword. |...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8 00010A R SFLR SFL 00020A 14 SFLNXTCHG A* A* (at least one input-capable field should be specified) A* 00040A R SFLCTLR SFLCTL(SFLR) 00050A SFLPAG(17) 00060A SFLSIZ(17) 00070A SFLDSP SFLDSPCTL</pre>
Last Wiki Answer Submitted:  May 25, 2011  5:36 pm  by  CharlieBrowne   32,785 pts.
All Answer Wiki Contributors:  CharlieBrowne   32,785 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

Are you outputting the MAP1 record after doing the error checking? (If so, why?)

Tom

 107,735 pts.

 

Hi, I have seen the similar scenario with subfiles(But in RPGLE).
I got it finally by using CSRRRN. I was successful in this issue by moving the RRN to CSRRRN when ever there we get a first error. So, that it will point to the first error position instead of first record.
Hope the same help you.

 3,370 pts.

 

I was successful in this issue by moving the RRN to CSRRRN when ever there we get a first error.

I assume that you mean SFLCSRRRN() since CSRRRN isn’t a valid keyword.

That keyword will help with determining the subfile RRN that the cursor is on when control returns to the program. It might be used together with SFLRCDNBR(CURSOR) to reposition to the appropriate subfile page when the subfile is output again. Unfortunately, it won’t determine what field the cursor ends up in except that the cursor will be in the first input-capable field.

There is also the CSRLOC() keyword that can position the cursor on output. But it’s documented as being invalid for SFL formats.

However, if you have sample code that demonstrates how to make those work, please post it.

Tom

 107,735 pts.