what is the difference between clear and reset opcodes and
open and close opcodes?please tell me in real time senario
with example please?

And

What is the use of SFLNXTCHG?Where we can use this?

Answer Posted / john bulloch

Clear is used to re-initialise a set of data (fields,
arrays, data structures, record formats etc) to blanks for
alpha fields & zeros for numeric fields.
Reset is used to re-initialise a set of data (fields,
arrays, data structures, record formats etc) to it's
initial values set using the inz keyword.

When a file is defined as USROPN, you need to use OPEN &
CLOSE to (you guessed it) OPEN & CLOSE the file.

SFLNXTCHG is used when reading changed records in a subfile
using the READC opcode. The indicator is set on when the
data in the record changes.
For example, when you use READC to validate all the entries
in a subfile before updating or writing the data to a file,
the next time you use READC to perform the updates, you
wouldn't pick up the record you just validated without
reseting the SFLNXTCHG indicator as in the following:

(SFLNXTCHG is linked to indicator 85)

READC sflrec // read the first changed record
DOW not %EOF // process all changed records
Validate the record
*IN85 = *ON // Reset the SFLNXTCHG indicator
UPDATE SFLREC // Update it so that *IN85 sticks
READC sflrec // read the next changed record
ENDDO

now, when you readc to perform your updates, it will pick
up the records you validated in the previous loop

READC sflrec // read the first changed record
DOW not %EOF // process all changed records
update/write the data // read the next changed record
READC sflrec
ENDDO

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

how to run other job when one job is active?

586


what is sflrolval?

625


define the purpose of the *cat function?

937


how to validate input values in display file ?

647


explain the difference between defining subfile and message-subfile?

1063






what is the difference between packed decimal and zoned decimal?

2203


Difference Between Call & Sbmjob?

734


maximum number of subfiles that can be active for a single file is?

941


What Is The Purpose Of The "n" In The Following Calculation Specification?

649


what does the opcode free do?

1096


distinguish between terminating a program through seton lr and return?

535


what is the use of unique keyword and what level it is defined?

886


If i change any file through application after entering data , how to check which file is updated through applications . For call stack we takes esc 3 then we chose 11..But What is answer of below qtn..?

1456


A join logical file has how many record formats?

579


if dspatr(pc) and csrloc were specified for a format, which keyword would have priority?

973