View previous topic :: View next topic
|
Author |
Message |
vasanthavijayan
New User
Joined: 28 Sep 2010 Posts: 7 Location: Chennai
|
|
|
|
I have a requirement like below.
Input File 1:
ABCD00001 12345.00
BBCD00002 52345.00
ABED00003 12445.60
ABCD00005 45.60
AXKD00008 6745.60
Output:
ABCD00001 12345.00
BBCD00002 52345.00
ABED00003 12445.60
ABCD00004 0
ABCD00005 45.60
ABCD00006 0
ABCD00007 0
AXKD00008 6745.60
The number of input records will vary. The maximum limit would be 99999. The first 9 bytes is alphanumeric.
Vasanth |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
You mean you want to generate the "missing" keys with a zero value?
What's wrong with a simple little program to do it? |
|
Back to top |
|
|
vasanthavijayan
New User
Joined: 28 Sep 2010 Posts: 7 Location: Chennai
|
|
|
|
Yes. I want the missing keys with zero.
I am just wondering is there any way to do it with sort. |
|
Back to top |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1742 Location: Tirupur, India
|
|
|
|
Hi,
What is the logic behind the output records? A little more explanation would be helpful.
Do all the missing keys have ABCD as prefix? |
|
Back to top |
|
|
vasanthavijayan
New User
Joined: 28 Sep 2010 Posts: 7 Location: Chennai
|
|
|
|
Quote: |
What is the logic behind the output records?
|
The 5 bytes from position 5 will be sequence number for an index.
Quote: |
Do all the missing keys have ABCD as prefix?
|
Yes |
|
Back to top |
|
|
kratos86
Active User
Joined: 17 Mar 2008 Posts: 148 Location: Anna NGR
|
|
|
|
If you don't mind your output generated with the maximum limit of 99999. You can try something like this
Code: |
//PGM EXEC PGM=ICETOOL
//IN DD *
ABCD00001 12345.00
BBCD00002 52345.00
ABED00003 12445.60
ABCD00005 45.60
AXKD00008 6745.60
// DD *
ABCD00001 0
ABCD00002 0
ABCD00003 0
ABCD00004 0
ABCD00005 0
ABCD00006 0
ABCD00007 0
ABCD00008 0
//OUT DD SYSOUT=*
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//TOOLIN DD *
SELECT FROM(IN) TO(OUT) ON(5,5,ZD) FIRST |
output -
Code: |
ABCD00001 12345.00
BBCD00002 52345.00
ABED00003 12445.60
ABCD00004 0
ABCD00005 45.60
ABCD00006 0
ABCD00007 0
AXKD00008 6745.60 |
|
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
And if you are worried about all that typing, you can get DFSORT to generate that dataset for you. |
|
Back to top |
|
|
vasanthavijayan
New User
Joined: 28 Sep 2010 Posts: 7 Location: Chennai
|
|
|
|
Thanks kratos86
Is there any way to limit the output record to 8 for the above example?
The limit value will vary based on the input file. |
|
Back to top |
|
|
|