NAT3047 - Some doubts

Good Morning,

I’m taking the error NAT3047 at my program.
I know why this error occurs and how to solve it, but at actual situation of the program I cannot understand why it happens. Can someone explain me?

I have a main “READ” loop that updates the records using “GET” and “UPDATE” statements. Inside this “READ” I have other “READ” in another adabas file that don’t make any interaction on this file (UPDATE, STORE or DELETE), only reading. Inside this second READ, using the data of the records of this READ, I have a STORE statement in another adabas file and the program generates the error NAT3047 at the line of the STORE statement? By curiosity, I want to know if it occurs because a I have a read (in file xx, for example) and a store (in file yy, for example) inside this read? In the other words, it really can happens if I have a READ in one file and, inside this READ, I have a STORE in another file. Does it should happens only if I have a READ and a UPDATE at the same file and same READ, no??

Waiting some help.

Thank’s.

The error is a result of the GET and STORE statements being nested within a loop. The fact that the loop is a READ is not relevant. Each GET (because of the attached UPDATE) and each STORE place an ISN in the Hold Queue. (The DBA sets the Hold Queue size.) You have filled the queue and are attempting to STORE another record.

Right. You need to issue an END TRANSACTION once in a while, before the ET threshold is exceeded.

1 Like

Ralph Zbrog, thank’s for your explanation. You’ve solved my doubts about this situation.

To correct the program I did a code to control the ET considering the number of records read in the reading loop.

Really thankfull.

Ralph Zbrog,

I have another doubt, but now it’s around the ET control. Please, consider this program:

DEFINE DATA LOCAL
1 VIEW1 VIEW OF VIEW1-ABCD
   2 FIELD1      
   2 FIELD2
   2 FIELD3
*
1 VIEW-STORE VIEW OF VIEW1000-XXXX
   2 NAME     
   2 BORN-DATE
*  
1 #WK-NUM-RECORDS-READ   (N10) 
1 #WK-NUM-RECORDS-STORED (N10) 
END-DEFINE 
*
RESET #WK-NUM-RECORDS-READ
*
RD1. READ VIEW1 BY FIELD1
*
	ADD 1 TO #WK-NUM-RECORDS-READ
*
	IF FIELD2 > 20120809 	
		ESCAPE  TOP	
	END-IF 
*
	IF FIELD3 EQ ' ' 
		ESCAPE TOP
	END-IF 
*	
	PERFORM STORE-RECORD-VIEW1000-XXXX
*
        PERFORM ET-CONTROL
END-READ
*
* ------------------------------------------
DEFINE SUBROUTINE STORE-RECORD-VIEW1000-XXXX
* ------------------------------------------
*
MOVE RD1.FIELD2 TO BORN-DATE
MOVE RD1.FIELD3 TO NAME     
* 
STORE VIEW-STORE
* 	
ADD 1 TO #WK-NUM-RECORDS-STORED
*
END-SUBROUTINE
* 
* ------------------------------------------
DEFINE SUBROUTINE ET-CONTROL
* ------------------------------------------
*
IF #WK-NUM-RECORDS-READ GE 50
	RESET #WK-NUM-RECORDS-READ	
	END TRANSACTION
END-IF
* 
END-SUBROUTINE
* 
END
*

In this program I have some ESCAPE TOP that disconsider the record read by some condition, right? These disconsidered records are included at the Hold Queue of ADABAS because of the STORE statement in STORE-RECORD-VIEW1000-XXXX subroutine, right?

If correct, what is the best variable to decide the number of the records to perform the ET? #WK-NUM-RECORDS-READ or #WK-NUM-RECORDS-STORED ?? In this program I consider the variable #WK-NUM-RECORDS-READ because of the ESCAPE TOP that increases the number of records at Hold Queue.

This is the best practice? I can perform ET-CONTROL before the ESCAPE TOP to ensure the END TRANSACTION by 50 to 50 records, correct?

Thanks.

Your READ does not place records on hold because there is neither an UPDATE nor a DELETE attached to it. Perform the END TRANSACTION when the ET count reaches 50 or the READ count reaches 1000.