|
View previous topic :: View next topic
|
| Author |
Message |
TS70363
New User
Joined: 07 Apr 2010 Posts: 94 Location: Bangalore, India
|
|
|
|
Hi,
I have 3 files. All the 3 files are FB and of length 10.
The first 2 files contains a number each 10 bytes.
The 3 file has the percentage of the counts in FILE 2 with respect to counts in file 1.
File 1
File 2
File 3
I need to create an output file (FB, 80) to display:
| Code: |
Hi,
Total Counts in file 1 : 0000085000
Total Counts in file 2 : 0000000850
Percentage of total counts in file 2 with respect to counts in file 1 : 01.00 %
Thanks.
|
Can you please guide me?
Thanks in Advance. |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Assuming you only have 1 record in each file, the following DFSORT JCL will give you the desired results
| Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=Your Input FB 10 byte file1,DISP=SHR
// DD DSN=Your Input FB 10 byte file2,DISP=SHR
// DD DSN=Your Input FB 10 byte file3,DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=INIT,BUILD=(31:1,10,SEQNUM,1,ZD)),
IFTHEN=(WHEN=GROUP,BEGIN=(41,1,ZD,EQ,1),PUSH=(01:31,10),RECORDS=3),
IFTHEN=(WHEN=GROUP,BEGIN=(41,1,ZD,EQ,2),PUSH=(11:31,10),RECORDS=2),
IFTHEN=(WHEN=(41,1,ZD,EQ,3),OVERLAY=(21:31,10))
OUTFIL INCLUDE=(41,1,ZD,EQ,3),
BUILD=(C'HI,',/,/,
C'TOTAL COUNTS IN FILE 1 : ',01,10,/,
C'TOTAL COUNTS IN FILE 2 : ',11,10,/,/,
C'PERCENTAGE OF TOTAL COUNTS IN FILE 2 ',
C'WITH RESPECT TO COUNTS IN FILE 1 :',21,6,C'%',/,/,
C'THANKS.',80:X)
//* |
|
|
| Back to top |
|
 |
TS70363
New User
Joined: 07 Apr 2010 Posts: 94 Location: Bangalore, India
|
|
|
|
Hello Kolusu.
Thank you. It is working fine, |
|
| Back to top |
|
 |
TS70363
New User
Joined: 07 Apr 2010 Posts: 94 Location: Bangalore, India
|
|
|
|
Hi again,
Could you please help me decode
| Code: |
INREC IFTHEN=(WHEN=INIT,BUILD=(31:1,10,SEQNUM,1,ZD)),
IFTHEN=(WHEN=GROUP,BEGIN=(41,1,ZD,EQ,1),PUSH=(01:31,10),RECORDS=3),
IFTHEN=(WHEN=GROUP,BEGIN=(41,1,ZD,EQ,2),PUSH=(11:31,10),RECORDS=2),
IFTHEN=(WHEN=(41,1,ZD,EQ,3),OVERLAY=(21:31,10)) |
I have tried a lot to understand and google it but all invain.
Any help or relevant links would be highly appreciated.
Thanks. |
|
| Back to top |
|
 |
dbzTHEdinosauer
Global Moderator

Joined: 20 Oct 2006 Posts: 6965 Location: porcelain throne
|
|
|
|
TS70363,
i realize you have only been here for a couple of years,
and only have 50 posts,
but,
instead of wasting your time google'n,
why not use the hyperlink at the top of everypage in this website
that says IBM MANUALS (yep, that's a link)
then you can find the DFSORT manuals.
or,
you can look at the STICKY's in the dfsort forum,
which point to reference material
or
just click on the hyperlink in Kolusu's signature
and then click on publications.
pathetic......................... |
|
| Back to top |
|
 |
dbzTHEdinosauer
Global Moderator

Joined: 20 Oct 2006 Posts: 6965 Location: porcelain throne
|
|
|
|
TS70363,
what was the search criteria?
certainly not 'DFSORT manuals' About 74,800 results (0.26 seconds)
maybe it was something along the lines of
'help me with sort'
or
'i can not find the answer'
or
'can someone do my work for me, please?' |
|
| Back to top |
|
 |
TS70363
New User
Joined: 07 Apr 2010 Posts: 94 Location: Bangalore, India
|
|
|
|
Hi,
Thanks for guiding me thru the manuals.
With that help, I was able to find out the below:
Line1
| Code: |
INREC IFTHEN=(WHEN=INIT,BUILD=(31:1,10,SEQNUM,1,ZD))
|
For all the records in the input file - it will add a sequence number 1,2,3... at 41st position with bytes 1-30 as spaces
Intermediate File
| Code: |
=COLS> ----+----1----+----2----+----3----+----4---
****** ***************************** Top of Data *
000001 00000087251
000002 00000285302
000003 26.99 3
****** **************************** Bottom of Data |
Line 2
| Code: |
IFTHEN=(WHEN=GROUP,BEGIN=(41,1,ZD,EQ,1),PUSH=(01:31,10),RECORDS=3)
|
Will group 3 records beginning when 41st byte is 1 and place 31:10 charaters at starting at position 1
Intermediate File
| Code: |
=COLS> ----+----1----+----2----+----3----+----4----
****** ***************************** Top of Data **
000001 0000008725 00000087251
000002 0000008725 00000285302
000003 0000008725 26.99 3
****** **************************** Bottom of Data |
Line3
| Code: |
| IFTHEN=(WHEN=GROUP,BEGIN=(41,1,ZD,EQ,2),PUSH=(11:31,10),RECORDS=2) |
Same as Line 2
Intermediate File
| Code: |
=COLS> ----+----1----+----2----+----3----+----4----
****** ***************************** Top of Data **
000001 0000008725 00000087251
000002 00000087250000028530 00000285302
000003 00000087250000028530 26.99 3
****** **************************** Bottom of Data |
Line 3
| Code: |
| IFTHEN=(WHEN=(41,1,ZD,EQ,3),OVERLAY=(21:31,10)) |
Intermediate file
| Code: |
****** ***************************** Top of Data *
=COLS> ----+----1----+----2----+----3----+----4---
000001 0000008725 00000087251
000002 00000087250000028530 00000285302
000003 0000008725000002853026.99 26.99 3
****** **************************** Bottom of Data |
Could you please confirm my understanding?
Thanks.
TS70363 |
|
| Back to top |
|
 |
dbzTHEdinosauer
Global Moderator

Joined: 20 Oct 2006 Posts: 6965 Location: porcelain throne
|
|
|
|
TS70363,
apologize for my sarcasm.
you have done well too in your efforts.
either Bill or Kolusu will come along,
and I am sure that they will be happy to provide you with further insights. |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
I wish more people took the effort to do this to understand the solutions provided. Good job.
In doing this, you are far more likely to be able to do something similar next time, or even get some ideas for doing something dissimilar.
Notice that Kolusu would have done it differently if there were several million records involved, but "starting at 10s" and the repeated data makes the final part easier to code and understand for "short" files like yours.
The idea has been "get all the information I need onto one record, and then only use that record in OUTFIL to produce the report". |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
TS70363,
Kudos to you and you have a done an excellent job and your interpretation of the control cards is good. I wish more people do this.
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:
www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000080 |
|
| Back to top |
|
 |
TS70363
New User
Joined: 07 Apr 2010 Posts: 94 Location: Bangalore, India
|
|
|
|
Thanks Everyone..  |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|