×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
This issue may have already arisen previously but it has caused me such
a significant problem that I wish to mention it.
The code snippet below can demonstrate the problem I made for myself by
inadvertently having a field named SEQ_NO defined locally within a
sub-procedure while the same field also exists as a column in a file
read by the same sub-procedure.
The process was initially written to use a field named SEQ_NO defined
locally.
Then it was augmented to retrieve the SEQ_NO from the most recent SEQ_NO
column used on a file.
So the process needs to know the last sequence number on a file keyed by
FILE_NO/SEQ_NO.
I took a while to realize that the sub-procedure does not populate the
value of SEQ_NO from the file when it has also been defined locally.
The code seemed innocuous until used in a production run when duplicate
key errors began to arise because the SEQ_NO was not being incremented
correctly.
H DftActGrp(*No) Option(*NoDebugIO : *SrcStmt )
FTBLCA_DF IF E K DISK RENAME(TBLCA_DF:DFREC)
D procfile PR
/free
FILE_NO = 1200001;
procfile();
*inLR = *on;
Return;
/end-free
P procfile B
D SEQ_NO S 4 0
/free
// Retrieve last sequence no used for this FILE_NO
Setgt (FILE_NO) TBLCA_DF;
Readpe (FILE_NO) TBLCA_DF;
If %EOF;
SEQ_NO = 0; // If no masterfile then set to zero
Endif;
Dsply ('Last sequence no. is ' + %editC(SEQ_NO:'Z'));
/end-free
P E
Cheers, Peter
#####################################################################################
This correspondence is for the named person's use only. It may contain confidential or legally privileged information, or both. No confidentiality or privilege is waived or lost by any mistransmission. If you receive this correspondence in error, please immediately delete it from your system and notify the sender. You must not disclose, copy or rely on any part of this correspondence if you are not the intended recipient. Any views expressed in this message are those of the individual sender, except where the sender expressly, and with authority, states them to be the views of Veda Advantage. If you need assistance, please contact Veda Advantage on either :- Australia 133124 or New Zealand +64 9 367 6200
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact
[javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.