COBOL SubFile Processing

10 pts.
AS/400 Subfiles
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

Answer Wiki

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

Try the SFLNXTCHG keyword,
Here is a snippet from the IBM manual
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
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.
The following example shows how to specify the SFLNXTCHG keyword.
A* (at least one input-capable field should be specified)
00050A SFLPAG(17)
00060A SFLSIZ(17)

Discuss This Question: 3  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.
  • TomLiotta
    Are you outputting the MAP1 record after doing the error checking? (If so, why?) Tom
    125,585 pointsBadges:
  • deepu9321
    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.
    4,605 pointsBadges:
  • TomLiotta
    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
    125,585 pointsBadges:

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.


Share this item with your network: