I have a big file with Banknumber, branches and transactions.
The file is FB80. Position 1 Banknumber, position 19 Branchnumber. There is transaction data from 25 to 80. But i am only interested in counting.
Banks are from 001 to 260. Branches can be from 1 to 250. I need to get an output like:
Banknumber 001 : Total 6
Branch 1 : Total 3
Branch 2 : Total 1
Branch 3 : Total 1
Branch 151 : Total 1
Banknumber 002 : Total 3
Branch 1 : Total 1
Branch 2 : Total 1
Branch 151 : Total 1
Banknumber 003 : Total 2
Branch 1 : Total 1
Branch 15 : Total 1
Means count the banks, count trxs on branches and total, subtotal.
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
jose.jeyan,
Please do NOT send private messages seeking help. Please post in the forum itself. Thank you.
If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:
Coming to your issue, it is not clear as to what you are trying to do. Please answer the following questions.
1. What is the LRECL and RECFM of the input file?
2. What is the key field? 1, 4 ? or 194 ,3?
3. What do you have at position 241 for 8 bytes?
4. Show us a sample input (just show the contents of 1,4, 194,4 and 241,8) and desired output.
2. Input file is 300 lrecl & FB. Has records from 1-240.
Need to create reports based on 1,4 & 194,3 .
Say 194,3 is Branch Id
1,4 is Branch Num
3. 240 -300 is blank.
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
Jose.Jeyan,
Since you had made an effort to search and pick the right topic , I am going to explain the job in detail for your understanding. Use the following DFSORT JCL which will give you the desired results.
SORT FIELDS=(5,3,CH,A, $ BRANCH ID
1,4,CH,A) $ BRANCH NUM
SUM FIELDS=(8,8,ZD) $ SUM ON CONTANT
OUTREC BUILD=(C'BRANCH ', $ CONSTANT BRANCH
1,4, $ BRANCH NUM
5X, $ 5 SPACES
C'TOTAL : ', $ CONSTANT TOTAL
8,8,ZD, $ TOTAL OF CONSTANT
M10,LENGTH=8, $ LEADING ZERO SUPRESS EDIT MASK
81:5,3) $ BRANCH ID AT POSITION 81
OUTFIL REMOVECC, $ SUPRESS CARRIAGE CONTROL CHAR
SECTIONS=(81,3, $ CONTROL BREAK ON BRANCH ID
HEADER3=('BANK ID : ', $ CONSTANT BANK ID
81,3, $ BRANCH ID
/), $ WRITE ANOTHER EMPTY LINE
TRAILER3=(17:18'=', $ CONSTANT '=' AT POS 17
/, $ WRITE ANOTHER EMPTY LINE
17:'TOTAL : ', $ CONSTANT TOTAL AT POS 17
TOT=(27,8,UFF, $ TOTAL BY BRANCH ID
M10,LENGTH=8), $ EDIT MASK FOR TOTAL
/)), $ WRITE ANOTHER EMPTY LINE
TRAILER1=('TOTAL OF ', $ CONSTANT TOTAL OF
'ALL BRANCHES : ', $ CONSTANT ALL BRANCHES
TOT=(27,8,UFF, $ TOTAL BY ALL BRANCH ID'S
M10,LENGTH=10)) $ EDIT MASK FOR TOTAL
//*
will produce
Code:
BANK ID : AA1
BRANCH 1234 TOTAL : 1
BRANCH 3431 TOTAL : 1
==================
TOTAL : 2
BANK ID : AA2
BRANCH 2333 TOTAL : 1
BRANCH 2343 TOTAL : 1
==================
TOTAL : 2
TOTAL OF ALL BRANCHES : 4
I had comments explaining every step, and to understand it fully you need this diagram
Is that " OUTFIL REMOVECC,BUILD=(1,80)," you delibratly missed.
Whats the significance of having Header1,Header3 .Checked DFsort guide but coudlnt get much details on the difference between Header1,Header2,Header3. I am not sure i missing something.
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
jose.jeyan wrote:
Hi Kolusu,
Is that " OUTFIL REMOVECC,BUILD=(1,80)," you delibratly missed.
Yes. I did not have the BUILD parm in there and if you looked at the report it would have shown you the residual of the key in position 81.
jose.jeyan wrote:
Whats the significance of having Header1,Header3 .Checked DFsort guide but coudlnt get much details on the difference between Header1,Header2,Header3. I am not sure i missing something.
Thanks again on your guidance and support.
Regards,
Tony J.
Header1 = Appears only on first page of the report
Header2 = Appears on Every page of the report
Header3 = Appears before the first data record of each section(aka key break) in your case it is 81,3
The same applies for Trailer1,Trailer2, Trailer3 but it is at the bottom of the page.
Run this jcl and see how the headers are written. The default for LINES for a page is 60 but we can override that. run the following JCL with different control cards shown below and verify the output after every run and you will understand how Header1/2/3 and trailer1/2/3 works