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

counting the adjacent fields and writing in o/p file.


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
vinay ityala

New User


Joined: 07 Dec 2008
Posts: 5
Location: bangalore

PostPosted: Sun May 10, 2009 3:23 pm
Reply with quote

Hi All,

I had an I/p file which was displayed in the below format,

Code:
YEAR    MONTH   P-TYPE PLASTIC-DESC      CUTOFF TYPE 1    Typ2
------  ------  -----  ----------------  -----  --------  -----
2009    04      100    GRCC-GREEN        01     B         0
2009    04      100    GRCC-GREEN        01     B         0
2009    04      100    GRCC-GREEN        01     0         S
2008    04      100    GRCC-GREEN        02     0         S
2007    03      100    RCP-GREEN         01     B         0
2006    04      100    PLAT-GREEN        01     0         S
2005    04      100    GRCC-GREEN        01     B         0

------
have up to some 5 lack of records.

I want MY o/p file such that

if Year-month=P-type=plastic-desc=cutoff and depending on type B' or 's' I need to segregate the count of all those records and display in the o/p,
1) In the above I/p file ,Year,month,cut-off will be in ascending order

The o/p file will be have to be some thing like this

Code:
YEAR    MONTH   P-TYPE PLASTIC-DESC      CUTOFF Total-TYPE 1 Total-Typ2
------  ------  -----  ----------------  -----  --------     -----
2009    04      100    GRCC-GREEN        01     2            0
2009    04      100    GRCC-GREEN        01     0            1
2008    04      100    GRCC-GREEN        02     0            1
2007    03      100    RCP-GREEN         01     1            0
2006    04      100    PLAT-GREEN        01     0            1
2005    04      100    GRCC-GREEN        01     1            0


Pls let me know if any sort card(Sync sort is the product we are using in our company)or any other Jcl logic will be suitable for the above requirement,

I had already written a PGM for the above Requiremnt, as the i/p is having huge records, it was taking considerable amount of time and Iam
in the way of searching the altenate methods.


Thanks in advance.
Back to top
View user's profile Send private message
devangi83

New User


Joined: 05 May 2009
Posts: 7
Location: India

PostPosted: Sun May 10, 2009 8:36 pm
Reply with quote

how abt useing easytrieve instead of cobol program?
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Sun May 10, 2009 8:55 pm
Reply with quote

devangi83 wrote:
how abt useing easytrieve instead of cobol program?
What? The OP is looking for a sort solution.
And where did you read that the OP was using COBOL and not EZT?
Back to top
View user's profile Send private message
vinay ityala

New User


Joined: 07 Dec 2008
Posts: 5
Location: bangalore

PostPosted: Sun May 10, 2009 10:38 pm
Reply with quote

Hi devangi83,

easy trieve , i cannot use.. icon_sad.gif

Hi CICS Guy,

JUST FYI..Actually my req . is to read the i/p file which have those may records and have to produce the o/p of matching records and thier count opposite to it..

and what i have done is i have written the cobol program which satisfy the req,Iam cross verifying if any method is there to simlify the process
using sort cards...

let me know if any other info is required.

thanks fot ur quick responses
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Sun May 10, 2009 11:24 pm
Reply with quote

Quote:
let me know if any other info is required.

Your sample input file appears to already be sorted by YEAR, MONTH, P-TYPE, PLASTIC-DESC & CUTOFF, is this true for your actual input?
If true, a simple copy/sum with trailer processing should provide all you need.
Code:
YEAR    MONTH   P-TYPE PLASTIC-DESC      CUTOFF Total-TYPE 1 Total-Typ2
------  ------  -----  ----------------  -----  --------     -----
2009    04      100    GRCC-GREEN        01     2            1
2008    04      100    GRCC-GREEN        02     0            1
2007    03      100    RCP-GREEN         01     1            0
2006    04      100    PLAT-GREEN        01     0            1
2005    04      100    GRCC-GREEN        01     1            0
Would the above (the 2009 line) be as valid for your purposes?
What is the lrecl and recfm of your input and output?
Does the input have those headers?
Do you want those headers in your output?

By the way, do yourself a favor and "quote" your original post and see how the columns do not line up correctly.
Then highlight the quoted code and copy it and paste it into notepad and convert (if not already) the text to courier new and notice how well the columns do line up.
Neat, right? Just do not use tabs, only spaces.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Mon May 11, 2009 2:58 am
Reply with quote

vinay ityala,

Adding to the questions raised above,

Do you have any "TYPE 1" values in input file other than 'B' and '0'?
Do you have any "TYPE 2" values in input file other than 'S' and '0'?
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top