View previous topic :: View next topic
|
Author |
Message |
nareshratnala
New User
Joined: 27 May 2009 Posts: 8 Location: bangalore
|
|
|
|
Hi
I have a requirement where my client is asking like
file 1 has
A
B
C
D
E
but we need the output as below
AE
BC
CA
DB
ED.. Meaning one name is mapped to other and no repetition. can we do this with DFSORT
it is same like teaming or pairing with other row in the same file
Thanks, |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3053 Location: NYC,USA
|
|
|
|
Quote: |
but we need the output as below
AE
BC
CA
DB
ED.. |
On what basis you come up with this combination? Why (AD or DA) or (CE or EC) is/are not possible? |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
I've cleaned up the other topic.
It's most likely possible, but as Rohit has pointed out, we need to know the rules for the particular mapping.
First to fifth, second to third, third to first, fourth to second, fifth to fourth. You want it like that? Are there only five records on the file? If more, does the sequence repeat by fives? What to do with non-multiple-of-five numbers of records? |
|
Back to top |
|
|
nareshratnala
New User
Joined: 27 May 2009 Posts: 8 Location: bangalore
|
|
|
|
Hi,
there is no rule as such. we can map any row to other row.
it is more like below
1. A is called E
2. B is called C
3. C is called A
4. D is called B
5. E is called D
..
the same logic has to work for all the rows irrespective of the number of rows.. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
OK, would you like to describe for us the business requirement which this satisfies? |
|
Back to top |
|
|
nareshratnala
New User
Joined: 27 May 2009 Posts: 8 Location: bangalore
|
|
|
|
this is for automobile industry. they want to assign a model line code to all models. they want to maintain in a flat file. if any changes, they will easily run that sort step to get a unique and use that for the model lines.
Please let me know if it is done or not through sort step. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
And it doesn't matter which?
OK, easiest way is probably to use the Cardpunch. Punch out all the model line odes, one per card. Remove them from the hopper. Find a clean, dry, area unencumbered by furniture. Toss the cards in the air. Collect them, without reference to order.
JOINKEYS, on generated sequence numbers, the Models file repeating from the starting point when the total number of the model line codes is reached.
How many models are there there you need a program to do this?
Don't just state what it is being used for, but explain, with an example, how it works. If it seems reasonable, you'll get something. |
|
Back to top |
|
|
nareshratnala
New User
Joined: 27 May 2009 Posts: 8 Location: bangalore
|
|
|
|
Ok, have 50 models. writing a program is easiest way but for 50 records, it wont be good as of now.
can I have the jcl from you? |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3053 Location: NYC,USA
|
|
|
|
Even after four of your replies the requirements are not fully clear, so if you just need unique random numbers ( so called Model lines as we know by now) then use the sequence number concept as stated by Bill and if you search on this fourm you would get sample SORT cards and not JCL.
And btw what is the problem having a program and what approach anyways you think of ? |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
So why not use a complete cartesian join of all of the alphabet ?
Do it once, and then it's done forever. When they need a new code it's sitting there ready and waiting in the flat file. No need to recerate the file as it already contains all possible combinations.
*** This reply assumes that I have the slightest inkling of what you really want as it has not been explained with any real clarity. This response is liable to change without notice. Please see T&C's for details |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Well, I valiantly started on this, but after typing 26 alphabetic letters, I realised I wasn't going to be able to reach 50 Models. What now?
Please, construct a realistic representative input, expected output, and at least some clue as to why no-one cares how the mapping is done, they're just happy with whatever output you produce. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
But Bill, with the cartesian join of those 26 characters, you end up with
26 * 26 = 676 unique options.
Job done
I've done something very similar with SAS to generate the cartesian alpna numeric combinations as keys to an application VSAM file. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Yes, but there are 50 models and five model line codes, perhaps.
Unless there is some genuine and complete input from TS/OP, I'm going to Lock this topic soon. It is just too much fun... |
|
Back to top |
|
|
nareshratnala
New User
Joined: 27 May 2009 Posts: 8 Location: bangalore
|
|
|
|
50 model lines and 50 model codes...I can say like this
ALTIMA Is getting changed to the sentra
VERSA is getting changed to the rogue
Sentra line is getting changed to murano
Murano is getting changed to altima
Rogue to versa
I did not see any confusion here.
I need the old and new model lines
input file :
ALTIMA
SENTRA
VERSA
ROGUE
MURANO
OUTPUT
ALTIMA SENTRA
VERSA ROGUE
SENTRA MURANO
MURANO ALTIMA
ROGUE VERSA |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
What I don't get is that it doesn't seem to matter what gets changed to what, as long as everything gets changed to something unique.
Presumably you don't want to do this often. I think I'd sort (say middle two characters) or otherwise manually scramble one copy of the file and stick them together with the editor.
For one SORT step, I'd just look to offset everything by one, JOINKEYS on sequence numbers, one starting from zero, one stating from one, and use IFTHEN=(WHEN=GROUP to PUSH the very first value so that it is available for the last record. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
what the TS is doing is EYEBALL matching
the TS should realise that to program the thing an algorithmic definition is needed
time to lock the topic |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3053 Location: NYC,USA
|
|
|
|
Quote: |
ALTIMA Is getting changed to the sentra
VERSA is getting changed to the rogue
Sentra line is getting changed to murano
Murano is getting changed to altima
Rogue to versa
I did not see any confusion here. |
But we all do and hence you did not yet get any positive answer.
Quote: |
50 model lines and 50 model codes...I can say like this
ALTIMA Is getting changed to the sentra
VERSA is getting changed to the rogue
Sentra line is getting changed to murano
Murano is getting changed to altima
Rogue to versa
I did not see any confusion here.
I need the old and new model lines
input file :
ALTIMA
SENTRA
VERSA
ROGUE
MURANO
OUTPUT
ALTIMA SENTRA
VERSA ROGUE
SENTRA MURANO
MURANO ALTIMA
ROGUE VERSA |
Why do you not keep two separate files one contains the initial model name with a unique number and other contains the changed one with same corresponding unique number as that of file one. And then when you want to see old and new model lines then just simply use a join key on these unique number and reformat the model names besides each other. |
|
Back to top |
|
|
|