View previous topic :: View next topic
|
Author |
Message |
sakrat
Active User
Joined: 05 Feb 2014 Posts: 164 Location: India
|
|
|
|
Hi,
Lets take like below is my VB input file:
Code: |
111109A0000A1234
222208C000005678
333307M000019012
444406M000009013
555505M000029014
666604M000029015
777703A000019016
888802C000019017
999901M000029018
121201M000019019
|
I need my output report in output file as below:
Code: |
Total Records: 0006
CERTIFY COUNT
0 0001
1 0002
2 0003
|
Basically I need to include only "M" records in the 7th column & display the count (Both total count & count of each CERTIFY)
I used below ICETOOL code:
Code: |
//JOBNAM2 JOB ('FDFS'),NOTIFY=&userid
//STEP001 EXEC PGM=ICETOOL
//INP DD DSN=ABC.DEF.INP,DISP=SHR
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//TOOLIN DD *
COUNT FROM(INP) USING(CTL1) WRITE(OUT) TEXT('TOTAL RECORDS')
OCCUR FROM(INP) LIST(OUT) -
HEADER('CERTIFY') ON (12,1,CH) -
HEADER('COUNT') ON(VALCNT)
/*
//CTL1CNTL DD *
SORT FIELDS=COPY
INCLUDE COND=(7,1,CH,EQ,C'M')
/*
|
My input file is VB file....
First I tried COUNTING the total records in a separate step by creating out1 using SORT step converting VB to FB fille & in the 2nd step used icetool to display the total records for each CERTIFY.
But then I tried the above code to make everything in a single step. I am getting the count of records correctly. But I don't know how to include only "M" type records for counting each of the CERTIFY.
Can some one please give some idea about it.
Thanks |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
With VB you have to account for the RDW, so should you not be using
Code: |
INCLUDE COND=(11,1,CH,EQ,C'M') |
|
|
Back to top |
|
|
sakrat
Active User
Joined: 05 Feb 2014 Posts: 164 Location: India
|
|
|
|
Robert Sample wrote: |
With VB you have to account for the RDW, so should you not be using
Code: |
INCLUDE COND=(11,1,CH,EQ,C'M') |
|
Yes you are right that's my mistake...I will correct that, so that I will get total count.
Can you also give idea of how to include only "M" type records to get the count value of each CERTIFY. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
If you tell SORT that you want to INCLUDE records, you are not going to get anything but those records in your output. There are other options for processing records -- you need to review the SORT user's guide manual. |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3048 Location: NYC,USA
|
|
|
|
Quote: |
Can you also give idea of how to include only "M" type records to get the |
Ain't you already doing that? |
|
Back to top |
|
|
RahulG31
Active User
Joined: 20 Dec 2014 Posts: 446 Location: USA
|
|
|
|
If you copy your records to a temp file first, then it'll be easier to achieve.
Code: |
//TOOLIN DD *
COPY FROM(INP) USING(CTL1) TO(TMP)
COUNT FROM(TMP) WRITE(OUT) TEXT('TOTAL RECORDS')
OCCUR FROM(TMP) LIST(OUT) -
HEADER('CERTIFY') ON(12,1,CH) -
HEADER('COUNT') ON(VALCNT)
/*
//CTL1CNTL DD *
INCLUDE COND=(7,1,CH,EQ,C'M')
/* |
I tried this on FB, you can add RDW length wherever necessary.
. |
|
Back to top |
|
|
sakrat
Active User
Joined: 05 Feb 2014 Posts: 164 Location: India
|
|
|
|
RahulG31 wrote: |
If you copy your records to a temp file first, then it'll be easier to achieve.
Code: |
//TOOLIN DD *
COPY FROM(INP) USING(CTL1) TO(TMP)
COUNT FROM(TMP) WRITE(OUT) TEXT('TOTAL RECORDS')
OCCUR FROM(TMP) LIST(OUT) -
HEADER('CERTIFY') ON(12,1,CH) -
HEADER('COUNT') ON(VALCNT)
/*
//CTL1CNTL DD *
INCLUDE COND=(7,1,CH,EQ,C'M')
/* |
I tried this on FB, you can add RDW length wherever necessary.
. |
Right now i cannot access mainframe...I will try this way by monday...And one more help can I add TITLE & DATE with this report....?? I tried using the same after OCCURS statement but I need it before the COUNT statement, but when I tried, it resulted in RC12. |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
All sorts of things could gve a return code of 12. Show what you tried and the messages resulting from those attempts (note plural). |
|
Back to top |
|
|
sakrat
Active User
Joined: 05 Feb 2014 Posts: 164 Location: India
|
|
|
|
Nic Clouston wrote: |
All sorts of things could gve a return code of 12. Show what you tried and the messages resulting from those attempts (note plural). |
I can show only the code now as I dont have mainframe access now to get the error messages.
So Below are the options I tried one by one to get the needed result but dint get it in any way:
First try:
Code: |
//TOOLIN DD *
COUNT FROM(INP) USING(CTL1) WRITE(OUT) TEXT('TOTAL RECORDS:') WIDTH(121)
OCCUR FROM(INP) LIST(OUT) -
DISPLAY PAGE TITLE('SUMMARY REPORT') -
HEADER('CERTIFY') ON(12,1,CH) -
HEADER('COUNT') ON(VALCNT)
/*
//CTL1CNTL DD *
INCLUDE COND=(11,1,CH,EQ,C'M')
/*
|
The output that I got for above code is:
Code: |
TOTAL RECORDS: 6
[-1-] SUMMARY REPORT
CERTIFY COUNT
A 0001
0 0002
1 0004
2 0003
|
Here I got 2 things wrong
1) The SUMMARY REPORT was not before the TOTAL RECORDS
2) COUNT value for CERTIFY is taken wrong (i.e) It dint take only "M" type records.
So then I tried as below to display SUMMARY REPORT before the count, but this resulted in error:
Code: |
//TOOLIN DD *
DISPLAY PAGE TITLE('SUMMARY REPORT') -
COUNT FROM(INP) USING(CTL1) WRITE(OUT) TEXT('TOTAL RECORDS:') WIDTH(121)
OCCUR FROM(INP) LIST(OUT) -
HEADER('CERTIFY') ON(12,1,CH) -
HEADER('COUNT') ON(VALCNT)
/*
//CTL1CNTL DD *
INCLUDE COND=(11,1,CH,EQ,C'M')
/*
|
Then I searched google to see how can I display only the title with no values below so that I display the title & also searched to see if I can INCLUDE "M" type records. But no luck then posted my question here...
Now I got an idea of How to include "M" type records alone in the CERTIFY-COUNT.
But dint know to place the title before the TOTAL RECORDS |
|
Back to top |
|
|
|