Output should be :
Col1 Col2 Col3 Col4 Col5 Col6
519 20 3 2 3 2 (i.e) For Col1 519 and Col2 20 ==> The Unique occurrence of Col3 is '3' , Col4 is '2' , Col5 is '3' , Col6 is '2'.
Col1 Col2 Col3 Col4 Col5 Col6
519 21 3 2 2 2 (i.e) For Col1 519 and Col2 21 ==> The Unique occuerence of Col3 is '3' , Col4 is '2' , Col5 is '2' , Col6 is '2'.
I could do this by SAS program or by cobol internal sort.
1.With SAS the though the logic is simple , the input files will be in millions , which SAS may struggle to handle. and its a bigger file lot of other fields in it.
2. The cobol internal sort/Array logic is also dropped because of the file size.
Is there a way in SORT to do this if not in application programming?. (Eazytrieve is not in our shop)
Suggest you re-post using the code tag to make your post more readable and preserve the column alignment. There is a Preview so you can see your post as we will see it. When it looks as you wish, Submit.
Then, explain the rules more completely. The "output should be" examples do not appear to follow the rules. . . _________________ All the best,
di
Last edited by papadi on Tue Dec 28, 2010 5:31 pm; edited 1 time in total
Output should be :
Col1 Col2 Col3 Col4 Col5 Col6
519 20 3 2 3 2
Quote:
(i.e) For Col1 519 and Col2 20 ==> The Unique occuerence of Col3 is '3' , Col4 is '2' , Col5 is '3' , Col6 is '2'.
Code:
Col1 Col2 Col3 Col4 Col5 Col6
519 21 3 2 2 2
Quote:
(i.e) For Col1 519 and Col2 21 ==> The Unique occuerence of Col3 is '3' , Col4 is '2' , Col5 is '2' , Col6 is '2'.
I could do this by SAS program or by cobol internal sort.
1.With SAS the though the logic is simple , the input files will be in millions , which SAS may struggle to handle. and its a bigger file lot of other fields in it.
2. The cobol internal sort/Array logic is also dropped because of the file size.
Is there a way in SORT to do this if not in application programming?. (Eazytrieve is not in our shop)
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
Posted: Tue Dec 28, 2010 6:02 pm Post subject:
mainframemouli,
1. What is the LRECL and RECFM of the input file?
2. Is Col1 and Col2 considered a key? If so what is the position and format of these 2 fields?
3. What is the position and format of col3 , col4, col5?
4. What is the lrecl and recfm of the output file?
Dibakar,
I think OP needs a control break on col1 and col2 as a single key and he needs the unique count of col3, col4, and col5 for the combo of col1 and col2. _________________ Kolusu
www.linkedin.com/in/kolusu
1. What is the LRECL and RECFM of the input file?
Though the main input file is variable file with LRECL of 2000 , I could actually derive the input in the format provided in my post above.
OK , The LRECL = 80 , RECFM is FB
2. Is Col1 and Col2 considered a key? If so what is the position and format of these 2 fields?
Yes , Col1 and Col2 forms a Key.
3. What is the position and format of col3 , col4, col5?
Col3 , 4 , 5 and 6 are all alphanumeric
4. What is the lrecl and recfm of the output file?
The output file will actually a report with each page for col1 and col2 combination , like as below
Code:
Header
Col1(519) and Col2(20) combination - Page 1
Col3 Col4 Col5 Col6
3 2 3 2
Header
Col1(519) and Col2(21) combination - Page 2
Col3 Col4 Col5 Col6
3 2 2 2
are displayed.
Quote:
But Let me handle the report in a simple cobol program , because it requires some more data to provided in the report. So lets have the output as LRECL = 80 and RECFM = FB.
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
Posted: Tue Dec 28, 2010 10:58 pm Post subject:
mainframemouli wrote:
1. What is the LRECL and RECFM of the input file?
Though the main input file is variable file with LRECL of 2000 , I could actually derive the input in the format provided in my post above.
OK , The LRECL = 80 , RECFM is FB
Nope You are doing an extra pass which is not needed. Explain the details with the original File. There is NO need to extract the file with the desired fields as you can do the reformatting of the desired fields using INREC. _________________ Kolusu
www.linkedin.com/in/kolusu
1. What is the LRECL and RECFM of the input file?
The actual input file is a tape file with following attributes.
RECFM = VB LRECL = 020503 BLKSIZE = 027998
The part of layout which is of interest is as below :(The Layout is as it is from the beginning , Not altered)
Code:
01 IN-RECORD.
05 COL1 PIC 9(3) COMP-3.
05 XX PIC X.
05 COL2 PIC 9(2).
05 XX PIC X.
05 OHR-COLS.
10 COL3 PIC X(10).
10 COL4 PIC X(10).
10 COL5 PIC X(10).
10 COL6 PIC X(10).
etc...... Followed by other fields .......
The actual output should be :
Code:
SUMMARY REPORT PAGE 1
RUN DATE : XXXX
RUN TIME : XXXXX
DATA MONTH :
COL1 and COL2 COL3 COL4 COL5 COL6
SUMMARY REPORT PAGE 2
RUN DATE : XXXX
RUN TIME : XXXXX
DATA MONTH :
COL1 and COL2 COL3 COL4 COL5 COL6
etc.....
Some of the fields are not required , the COL1 is in Comp-3 format , so just to make things staright and easy to understand for you to provide solution , I have provided the input layout in a simple way.
Thought , Once I get the solution , I would fit that init to my actual requirement.
Apologize , If that is not the convenient means for you.
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
Posted: Wed Dec 29, 2010 5:23 pm Post subject:
mainframemouli,
Here is an untested DFSORT JCL which will give you the desired results. Since you wanted the break on 4 different fields , we concatenate the same input file 4 times each separated by a header. Using the header we add an ID number to each file and move the col3 , col4, col5 and col 6 to a common area based on the ID. We also trim your input to just 19 bytes and then perform the sort removing the duplicates. Once we do that we then have the unique counts for each.
I also assumed that you wanted to see the comp-3 field displayed , so I changed it to printable form of 3 bytes.
I am assuming that you will come back with more changes as your report is expecting the data month filed in the summary report. I guess you have to figure that out as to how to include it in the logic I proposed. And that is one of the reason I ask for complete details.
You can get the month names(Jan - Dec) easily and the week range(Monday- Sunday dates) easily.
What is required is
For Monthly : The Datamonth should be MM/YY (Like 01/11)
For weekly : The Dataweek should be Week Number for that year.
For example for 2011 Jan 1st week should be , WEEK 1
For example for 2011 Jan 2nd week should be , WEEK 2 etc...
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
Posted: Wed Jan 05, 2011 2:06 pm Post subject:
mainframemouli wrote:
What is required is
For Monthly : The Datamonth should be MM/YY (Like 01/11)
For weekly : The Dataweek should be Week Number for that year.
For example for 2011 Jan 1st week should be , WEEK 1
For example for 2011 Jan 2nd week should be , WEEK 2 etc...
mainframemouli,
Monthly part is easy. You can just add SYMNAMES DD name and use them in the Header3 like this
Code:
//SYMNAMES DD *
YNUM,S'&LYR2'
MNUM,S'&LMON'
and Header3 we will change this line to
Code:
50:'DATA MONTH : ',/),
to
Code:
50:'DATA MONTH : ',MNUM,'/',YNUM,/),
However the Week Number part is not that easy. There are different forms of calculating the week number depending on the region.
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