View previous topic :: View next topic
|
Author |
Message |
hailashwin
New User
Joined: 16 Oct 2008 Posts: 74 Location: Boston
|
|
|
|
Hi,
I have a very specific condition here.
My data has a 9 byte field followed by four 1 byte fields as 9+1+1+1+1 Bytes. The 9 byte field can have repetitions and the four 1 byte field are (Y/N) indicator values. Now as per my requirement, I would like to consolidate all the 9 byte column(to avoid repetitions) and if there is atleast one 'Y' in my 1 byte column my final report should have 'Y', else it will carry a 'N' (for that particular 1 byte field only) . This is applicable for all the four 1 byte columns. Please have a look at the example below.
Example:
Input File:
AAAAAAAAANNNN
BBBBBBBBBNNNN
BBBBBBBBBNNNN
BBBBBBBBBYNNN
BBBBBBBBBNNNN
BBBBBBBBBNNNN
BBBBBBBBBNNYN
CCCCCCCCCNYNN
CCCCCCCCCNYYN
Final Report:
AAAAAAAAANNNN
BBBBBBBBBYNYN
CCCCCCCCCNYYN
Would it be possible to achieve this in a single sort step? May sound over ambitious...but please advice.. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Here's a DFSORT/ICETOOL job that will do what you asked for in one step/pass:
Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file
//OUT DD DSN=... output file
//TOOLIN DD *
SPLICE FROM(IN) TO(OUT) ON(1,9,CH) KEEPNODUPS WITHANY -
WITH(10,1) WITH(11,1) WITH(12,1) WITH(13,1) USING(CTL1)
/*
//CTL1CNTL DD *
OPTION COPY
INREC FINDREP=(STARTPOS=10,ENDPOS=13,INOUT=(C'N',C' '))
OUTFIL FNAMES=OUT,
FINDREP=(STARTPOS=10,ENDPOS=13,INOUT=(C' ',C'N'))
/*
|
|
|
Back to top |
|
|
hailashwin
New User
Joined: 16 Oct 2008 Posts: 74 Location: Boston
|
|
|
|
Frank,
Thank you very much for the timely help
But there are two conditions that I thought I can handle once this is ready but for the moment not able to add to the sort step you gave me.
My conditions are
1. I have a header on the file and would like to stay as the first record and free from manipulation
2. There are delimiters between each of the 5 fields(9+1+1+1+1 fields) that I had mentioned earlier that I would like to carry over to my report without any change.
Please advice how I would have to go about handling it.
Thanks,
Ashwin. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Rather than posting additions to the requirement as solutions are provided, suggest you show a complete example of your input and the actual output you want when your proces is run. . .
Why should people work on multiple solutions when one would be sufficient if all of the requirement was posted initially. . . |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Ashwin,
Please provide a better example of input and output as Dick suggests.
Also, what is the RECFM and LRECL of the input file?
Can the header be identified in some way (e.g. H in position 1) aside from being the first record? |
|
Back to top |
|
|
hailashwin
New User
Joined: 16 Oct 2008 Posts: 74 Location: Boston
|
|
|
|
Frank/Dick,
My Apologies. I thought I can build it further from the solution provided, but wasnt able to..
The LRECL=98 bytes ( This is to accomodate the header though my data is only 18 bytes long), RECFM=FB.
Yes, the header is static and can be identified with 'XXXX' in position 1 to 4.
Example:
Sample Input:
Code: |
XXXXMYHEADER INFORMATIONXXX
AAAAAAAAA!N!N!N!N!
BBBBBBBBB!N!N!N!N!
BBBBBBBBB!N!N!N!N!
BBBBBBBBB!Y!N!N!N!
BBBBBBBBB!N!N!N!N!
BBBBBBBBB!N!N!N!N!
BBBBBBBBB!N!N!Y!N!
CCCCCCCCC!N!Y!N!N!
CCCCCCCCC!N!Y!Y!N! |
Final Report:
Code: |
XXXXMYHEADER INFORMATIONXXX
AAAAAAAAA!N!N!N!N!
BBBBBBBBB!Y!N!Y!N!
CCCCCCCCC!N!Y!Y!N! |
|
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Suggest you become familiar/comfortable with the "Code" Tag. Your last post has been "Code"d.
What happens if later in the data is a record like:
|
|
Back to top |
|
|
hailashwin
New User
Joined: 16 Oct 2008 Posts: 74 Location: Boston
|
|
|
|
Thanks for the suggestion Dick. ll Follow from here on..
I can assure you that the file wouldn't have 'XXXX' in position 1 to 4 except on the header record. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Here's a DFSORT job for your revised requirements:
Code: |
//S2 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file
//OUT DD DSN=... output file
//TOOLIN DD *
SPLICE FROM(IN) TO(OUT) ON(1,9,CH) KEEPNODUPS WITHANY -
WITH(11,1) WITH(13,1) WITH(15,1) WITH(17,1) USING(CTL1)
/*
//CTL1CNTL DD *
OPTION COPY
INREC FINDREP=(STARTPOS=10,ENDPOS=17,INOUT=(C'!N',C'! '))
OUTFIL FNAMES=OUT,
FINDREP=(STARTPOS=10,ENDPOS=17,INOUT=(C'! ',C'!N'))
/*
|
|
|
Back to top |
|
|
hailashwin
New User
Joined: 16 Oct 2008 Posts: 74 Location: Boston
|
|
|
|
Thank you very much Frank. It worked!
I would really appreciate if you could guide me in getting a few materials from where I can start learning a few things on ICETOOL.
Thanks,
Ashwin. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Ashwin,
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 |
|
|
hailashwin
New User
Joined: 16 Oct 2008 Posts: 74 Location: Boston
|
|
|
|
Thanks Frank.
I really appreciate the great work you guys are putting with DFSORT...it really has brought down the time spent on developing and testing a cobol program. I think many who have worked on both would agree with me.
Great going...
Thanks again for all the help. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Thanks for the kind words. |
|
Back to top |
|
|
|