IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

mapping one record with other within same file using dfsort


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
nareshratnala

New User


Joined: 27 May 2009
Posts: 8
Location: bangalore

PostPosted: Thu Oct 16, 2014 3:31 am
Reply with quote

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
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Thu Oct 16, 2014 4:04 am
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Oct 16, 2014 5:15 am
Reply with quote

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
View user's profile Send private message
nareshratnala

New User


Joined: 27 May 2009
Posts: 8
Location: bangalore

PostPosted: Thu Oct 16, 2014 8:10 am
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Oct 16, 2014 11:49 am
Reply with quote

OK, would you like to describe for us the business requirement which this satisfies?
Back to top
View user's profile Send private message
nareshratnala

New User


Joined: 27 May 2009
Posts: 8
Location: bangalore

PostPosted: Thu Oct 16, 2014 6:30 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Oct 16, 2014 6:39 pm
Reply with quote

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
View user's profile Send private message
nareshratnala

New User


Joined: 27 May 2009
Posts: 8
Location: bangalore

PostPosted: Thu Oct 16, 2014 6:43 pm
Reply with quote

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
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Thu Oct 16, 2014 8:35 pm
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu Oct 16, 2014 8:39 pm
Reply with quote

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 icon_biggrin.gif
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Oct 16, 2014 8:58 pm
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu Oct 16, 2014 9:18 pm
Reply with quote

But Bill, with the cartesian join of those 26 characters, you end up with
26 * 26 = 676 unique options.

Job done icon_lol.gif

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Oct 16, 2014 9:34 pm
Reply with quote

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
View user's profile Send private message
nareshratnala

New User


Joined: 27 May 2009
Posts: 8
Location: bangalore

PostPosted: Thu Oct 16, 2014 10:45 pm
Reply with 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
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Oct 16, 2014 11:33 pm
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Oct 17, 2014 12:25 am
Reply with quote

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 icon_cool.gif
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Fri Oct 17, 2014 1:46 am
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 3
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top