Pages

Friday, February 14, 2020

READC & SFLNXTCHG

READC & SFLNXTCHG

READC and SFLNXTCHG are the two popular keywords used when working with subfiles. This short post explains what is the use of these two keywords. 

READC

READC is used to Read the Changed Records in a Subfile.

SFLNXTCHG

SFLNXTCHG is used to mark the Records in a Subfile as Changed.

SFLNXTCHG plays a Major role when there is a Subfile with Update capabilities.

While processing the Subfile, Changed Records can be read using 'READC'. However, In most cases where Update is involved it is essential to validate the data before Update.

Modified tag would be automatically turned off on a record when Program reads the Changed Record (using READC) for validation and wouldn't be able to read the record again for the actual UPDATE operation.

This can be controlled using SFLNXTCHG Keyword.

SFLNXTCHG can be used in two different ways.

  1. Use SFLNXTCHG Keyword without any indicator
  2. Control SFLNXTCHG Keyword with indicator. 

Using SFLNXTCHG without any indicator would mark all the records written into Subfile as Changed by default. And, all of these records can be read by READC even if there is no Change has been done by the Screen User.

This may take more time in processing the subfile and may not be required to read all the records specially when there are large number of records in Subfile.

Controlling SFLNXTCHG Keyword with indicator would be preferred in these cases.

When a record is changed, Record would be marked as 'Changed' by default and can be read using READC. Turn ON the Indicator on SFLNXTCHG Keyword once the record is read using READC and UPDATE the Subfile. This would mark the record as 'Changed' and can be read again using READC. 

No comments:

Post a Comment

How to Iterate Over a List and Get Indexes with 'enumerate' Function in Python

'enumerate' function There are different ways of accessing the data from a list like using range and then index or accessing the ele...