Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

mapping one record with other within same file using dfsort

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: mapping one record with other within same file using dfsort
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

Senior Member


Joined: 21 Sep 2010
Posts: 1609
Location: NY,USA

PostPosted: Thu Oct 16, 2014 4:04 am    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Thu Oct 16, 2014 5:15 am    Post subject: Reply to: mapping one record with other within same file usi
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Thu Oct 16, 2014 11:49 am    Post subject: Reply to: mapping one record with other within same file usi
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Thu Oct 16, 2014 6:39 pm    Post subject: Reply to: mapping one record with other within same file usi
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    Post subject:
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

Senior Member


Joined: 21 Sep 2010
Posts: 1609
Location: NY,USA

PostPosted: Thu Oct 16, 2014 8:35 pm    Post subject:
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: 8593
Location: Back in jolly old England

PostPosted: Thu Oct 16, 2014 8:39 pm    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Thu Oct 16, 2014 8:58 pm    Post subject: Reply to: mapping one record with other within same file usi
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: 8593
Location: Back in jolly old England

PostPosted: Thu Oct 16, 2014 9:18 pm    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Thu Oct 16, 2014 9:34 pm    Post subject: Reply to: mapping one record with other within same file usi
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Thu Oct 16, 2014 11:33 pm    Post subject: Reply to: mapping one record with other within same file usi
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Fri Oct 17, 2014 12:25 am    Post subject: Reply to: mapping one record with other within same file usi
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

Senior Member


Joined: 21 Sep 2010
Posts: 1609
Location: NY,USA

PostPosted: Fri Oct 17, 2014 1:46 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us