Prepare an output file based on the values from input file fields.
The last field in output file is a Group Field which consists of 20 positions. If the input record contains 0001, the first position will be 1 and the remaining 19 positions will be dots.
Input File:
XXX-XX-XXXX X 0001
XXX-XX-XXXX X 0002
XXX-XX-XXXX X 0020
Output File:
XXX-XX-XXXX X 1...................
XXX-XX-XXXX X .1..................
XXX-XX-XXXX X ...................1
Can anyone help me out in doing this requirement in DFSORT?
But I want to do it dynamically without using 20 IFTHEN. The sort card looks big n redundant. I hope there is some other better method than this. Please let me know if there is anything.
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
Sharp solution, cleaner than the one I was thinking of.....
Are you inferring that there will be more than just the 20 positions?
Maybe Frank or Kolusu will come up with something.....
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Quote:
But I want to do it dynamically without using 20 IFTHEN. The sort card looks big n redundant. I hope there is some other better method than this. Please let me know if there is anything.
Depends on what you mean by more dynamically. We could generate the IFTHEN clauses so you don't have to handcode them, but that would still require using the IFTHEN clauses.
Mathematically, it could be done using exponents, but DFSORT doesn't support exponents.
Quote:
Are you inferring that there will be more than just the 20 positions?
Here, I thought it is possible to make the overlay position(In the above line it is 15) dynamically. It is always value of field from position 11 to 4 plus 14. So I thought there might some other thing which I can do, to make it dynamically. But It seems, not.
Also it would be helpful if you can help me in similar requirement. Actually that is my actual requirement.
I want to generate a output file like the following from the input file given below:
I mean, the first 9 bytes are Key and I want to generate a bit map kind of thing using the values given in field position 10-13. If the same key has two rows with values 2 and 3, then I want to generate a single row with the key value and bitmap like .11.................
Hope I made myself clear about my requirement. Please let me know whether it is possible using DFSORT, so that I can avoid writing one COBOL program for this kind of requirement.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Quote:
Here, I thought it is possible to make the overlay position(In the above line it is 15) dynamically. It is always value of field from position 11 to 4 plus 14. So I thought there might some other thing which I can do, to make it dynamically.
You could do that using DFSORT's arithmetic functions to calculate the overlay position and dynamically create a control statement with that position in it.
I could probably show you how to do what you want with multiple IFTHEN statements, but I really don't have time to work out the dynamic "method". Maybe Kolusu would have time, but he's taken the afternoon off, so it would be Monday before he got to it. I'll send him a note about it.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Kannan,
Kolusu has a different interpretation of what you want then I did. Hopefully, he's right about what you want. If not, then please be more specific about what exactly you want to be "dynamic".
Thanks a Ton. Amazing logic :-). I would like to know that my requirement has been solved using this sort card. Thanks Again.
Frank,
The sort card solved my requirement perfectly. Actually By Dynamic I mean, instead of writing 20 different IFTHEN, is there any possibility to have one IFTHEN which solves the same purpose.
Let me explain clearly about what I meant by "Dynamic".
In the above sort card,
the character '1' is overlayed on position 15+01, if the value of position (11-15) is equals 02. And the same character '1' is overlayed on position 15+02 , if the value of postition (11-15) equals 03 and so on....
The overlay character is constant and only the overlay character position is varying based on the values in position 11-15.
So I just wanted to know, is there any possibility to write one line of sort card to handle this changing overlay position instead of writing multiple IFTHEN's. Hope i made myself clear about what i meant by "Dynamic".
Kindly let me know if there is any possibilty. Just a curiosity to know this :-)