MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

EasyTrieve TERMINATION proc not really at the end

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
andrew
Beginner


Joined: 18 Dec 2004
Posts: 5
Topics: 2

PostPosted: Fri Feb 24, 2006 3:33 am    Post subject: EasyTrieve TERMINATION proc not really at the end Reply with quote

Hi Every,

Has a TERMINATION proc to print record count at the end of report. However, when SEQUENCE present in report definition. The count always less than the actual count. Even more surprising, when the display the count in FINISH proc, the count is correct !?

Physical input record count = 3607
Records printed on report = 3607
Record count printed at FINISH = 3607
Record count printed at TERMINATION = 3607 (without SEQUENCE)
Record count printed at TERMINATION = 2889 (with SEQUENCE, how come Question )

Does anyone has an idea to explain this? It seems that when SEQUENCE is effective, TERMINATION is the last line of report but not the last record of JOB. A simplifed code is included.

Andrew.

Code:

FILE REP1 PRINTER
FILE EMP
  EMP-NAME    1  40  A
  EMP-SALARY 41   9  N
W-CNT         W   4  P  VALUE 0
*
JOB INPUT EMP FINISH FINAL-PROC
  W-CNT = W-CNT + 1
  PRINT REP1
*
FINAL-PROC. PROC
  DISPLAY 'TOTAL EMP READ AT FINAL ' W-CNT
END-PROC
*
REPORT REP1 PRINTER PRINT01
SEQUENCE EMP-SALARY
LINE EMP-NAME EMP-SALARY
TERMINATION. PROC
  DISPLAY SKIP 1 'TOTAL EMP READ AT TERM ' W-CNT
END-PROC
*
* RESULT IS
* TOTAL EMP READ AT FINAL 3607
* TOTAL EMP READ AT TERM  2889
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Fri Feb 24, 2006 6:16 am    Post subject: Reply with quote

Andrew,

The mismatches in Counts is due to Duplicates in the input. If your input has duplicates the counts are off. Since you are not doing a summary report , it only reports unique values. Try removing the duplicates and re-run the same job. you will see the counts to be the same.

oh btw you really don't need a variable for count and then manually increment it everytime. you can use the system defined variable RECORD-COUNT.

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
andrew
Beginner


Joined: 18 Dec 2004
Posts: 5
Topics: 2

PostPosted: Fri Feb 24, 2006 11:48 pm    Post subject: Reply with quote

Kolusu,

Yes, no issue when SEQUENCE with a unique field. In fact my original program sequence on year of date joined, and a lot computations based on count of records, sum of salary at control breaks. In fact the AFTER-BREAK proc also got incorrect result. It took me half a day to narrow down to this issue. Eventually solved by adding a DFSORT step and remove SEQUENCE from EZT program.

My question is: when SEQUENCE with a non-unique field, is it a wrong approach to put user accumulation logic in JOB, but to be printed on control break? (If we need statistics beyond simple sum and tally provided by CONTROL. My original program need to look up a rate in external file based on year to compute the total at control break.)

Anyway this surprised me and going to avoid TERMINATE and AFTER-BREAK user logic when SEQUENCE with non-unique field.

Andrew.
Back to top
View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group