Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Get the counts thru EZT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CA Products
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    Post subject: Get the counts thru EZT
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

Site Director


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

PostPosted: Sat May 05, 2007 2:26 am    Post subject:
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    Post subject: Re: Get the counts thru EZT
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

Site Director


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

PostPosted: Sat May 05, 2007 3:20 am    Post subject:
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    Post subject: Re: Get the counts thru EZT
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

Site Director


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

PostPosted: Mon May 07, 2007 8:24 am    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Mon May 07, 2007 7:14 pm    Post subject:
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    Post subject: Re: Get the counts thru EZT
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

Site Director


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

PostPosted: Mon May 07, 2007 8:23 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> CA Products All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts IMS T-Pipe queue counts in a COBOL Pr... Siva NKK Kothamasu IMS DB/DC 2 Tue May 09, 2017 6:31 pm
No new posts Add Counts to Group Header Records Christopher Horowitz SYNCSORT 3 Sat Jul 11, 2015 1:21 am
No new posts Update Group Headers with Record Counts Christopher Horowitz DFSORT/ICETOOL 9 Fri Jul 10, 2015 8:32 pm
No new posts Counts Using ICETOOL Skolusu DFSORT/ICETOOL 8 Wed Mar 05, 2014 3:33 pm
No new posts counts of multiple datasets into sing... rikdeb JCL & VSAM 4 Sat Jul 27, 2013 3:06 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us