IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Get the counts thru EZT


IBM Mainframe Forums -> CA Products
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
gprerna

New User


Joined: 21 Mar 2007
Posts: 38
Location: US

PostPosted: Sat May 05, 2007 1:39 am
Reply with quote

Hi,

I have the below requirement:

A
A
B
B
B

In the output i need as below:

A 2
B 3


Can any one assist me how this can be done thru Easytrieve? I have coded, but i am not getting the count for the last record i.e 'B'.

Thanks!
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sat May 05, 2007 2:26 am
Reply with quote

Hello,

Please post your input, code and the output you get with that input & code.

If we can see your code and the data, maybe we can offer suggestions.
Back to top
View user's profile Send private message
gprerna

New User


Joined: 21 Mar 2007
Posts: 38
Location: US

PostPosted: Sat May 05, 2007 2:30 am
Reply with quote

Hi,

This is the code:

FILE INFILE FB(30 3000)
A-TYPE 1 30 A
*
FILE OUTFILE FB(40 4000)
B-TYPE 1 30 A
B-COUNT 31 9 N
*
W-FIRST-TIME W 9 N VALUE 1
W-REC W 40 A
W-PREV-TYPE W-REC 30 A
W-COUNT W-REC +30 9 N VALUE 0
*
JOB INPUT INFILE
IF NOT EOF INFILE
IF W-FIRST-TIME = 1
MOVE A-TYPE TO W-PREV-TYPE
W-FIRST-TIME = 2
END-IF
IF A-TYPE = W-PREV-TYPE
W-COUNT = W-COUNT + 1
ELSE
MOVE W-PREV-TYPE TO B-TYPE
MOVE W-COUNT TO B-COUNT
PUT OUTFILE
W-COUNT = 1
END-IF
MOVE A-TYPE TO W-PREV-TYPE
END-IF
IF EOF INFILE
STOP
END-IF


INFILE data:

A
A
B
B
B

OUTFILE expected o/p:

A 000000002
B 000000003


Thanks!!
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sat May 05, 2007 3:20 am
Reply with quote

Hello,

You are getting the proper count for type "A" but no count for type "B"?

If so, i'd suggest repeating these lines:
Code:
MOVE W-PREV-TYPE TO B-TYPE
MOVE W-COUNT TO B-COUNT
PUT OUTFILE
after the "IF EOF" and before the "STOP".
Code:
IF EOF INFILE
                      <----  insert here
STOP
END-IF

The way the posted code is structured, there is no code to print the last count.
Back to top
View user's profile Send private message
gprerna

New User


Joined: 21 Mar 2007
Posts: 38
Location: US

PostPosted: Mon May 07, 2007 8:03 am
Reply with quote

I tried this, but it doesnt work icon_sad.gif

Infact i had put a display statement, and noticed that its not going in the below if condition:

IF EOF INFILE
DISPLAY 'EOF'
STOP
END-IF

The code i used:

IF EOF INFILE
DISPLAY 'ITS END OF FILE'
MOVE W-PREV-TYPE TO B-TYPE
MOVE W-COUNT TO B-COUNT
PUT OUTFILE
STOP
END-IF


This didnt display anything in the spool.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon May 07, 2007 8:24 am
Reply with quote

Hello,

I'm away from most of my material, so i can't send good examples just now.

I suggested the earlier change because it fit your code. In the code we use, the "at end" is specified in the "JOB INPUT INFILE " statement. There are not checks for eof in the code at the read and "at the bottom". When the input raises eof, control is transferred to an end-of-file routine where the final totals are printed.

Let me know if this is not clear and i'll send a better example on Monday when i'm on a different computer.
Back to top
View user's profile Send private message
Devzee

Active Member


Joined: 20 Jan 2007
Posts: 684
Location: Hollywood

PostPosted: Mon May 07, 2007 9:52 am
Reply with quote

Code:

JOB INPUT INFILE


Change job statement as below and try this
Code:

JOB INPUT NULL
GET  INFILE
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon May 07, 2007 7:14 pm
Reply with quote

Hello,

As i mentioned last night, following is an example of how many of our Easytrieve code that groups totals is coded.

After the working-storage items is
Code:
JOB INPUT COOIN FINISH SHOW-TOTALS


and this is at the end of the code:
Code:
SHOW-TOTALS. PROC
code to print totals and/or output final record


Code to show the last group of totals or output a summary record is included in the SHOW-TOTALS PROC.
Back to top
View user's profile Send private message
gprerna

New User


Joined: 21 Mar 2007
Posts: 38
Location: US

PostPosted: Mon May 07, 2007 8:08 pm
Reply with quote

Hey,

Thanks a lot!!
I used the proc... that really worked!!
You are great icon_biggrin.gif
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon May 07, 2007 8:23 pm
Reply with quote

You're welcome - glad we could help icon_smile.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CA Products

 


Similar Topics
Topic Forum Replies
No new posts Select two different counts from SQL... DB2 6
No new posts Checking the total counts inside a re... JCL & VSAM 5
No new posts Reformat clause in joinkeys sortcard ... DFSORT/ICETOOL 2
No new posts Updating multiple counts in trailer!! SYNCSORT 4
No new posts IMS T-Pipe queue counts in a COBOL Pr... IMS DB/DC 2
Search our Forums:

Back to Top