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
 

 

How to Split, Swap and Reverse a string using Sort?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
simmimahajan

New User


Joined: 27 Mar 2007
Posts: 30
Location: USA

PostPosted: Wed Jul 16, 2008 8:48 pm    Post subject: How to Split, Swap and Reverse a string using Sort?
Reply with quote

Hello,

I have a requirement wherein I would have a file which will contain FirstName, LastName, and other such fields. Consider FName = Brena
LName = Lori
I need to do the following:

1. Swap FName and LName
O/p Should be FName = LORI, LName = BRENA

2. Split the FName & LName by getting the midpoint and reverse again as follows

FNAME
'LORI' Split = Char(Length of FName/2) = Output will be O
'LORI' Reverse = OLIR --> Final output of Step 2

LNAME
'Brena' Split = Char(Length of NName/2) = Output will be 'E'
'BRENA Reverse' = RBEAN --> Final output of Step 2

3. Reverse the output of Step 2

FName = RILO

LName = NAEBR

May I know how can I achieve this through SORT.

Also is there some other faster and easier way to achieve this other than SORT?
We may have to do this for millions of records, hence performance is also a criteria.

Looking forward for some positive reply.

Thanks!
Back to top
View user's profile Send private message

simmimahajan

New User


Joined: 27 Mar 2007
Posts: 30
Location: USA

PostPosted: Wed Jul 16, 2008 10:51 pm    Post subject: Reply to: How to Split, Swap and Reverse a string using Sort
Reply with quote

Hello Again,

In the earlier post I did not specify the exact objective of doing this. Basically we are trying to scramble the String. But we need to ensure that any logic provided should be irreversible.

Hence we were working on different options like SQL using DB2, Sort OR Cobol/ Rexx Program. Ideally we want to achieve this at database level but doing this through DB2 would hit the performance drastically hence we have rejected this option. Also I got to know it is not advisable to use SORT on the String as it works more better for Packed Decimals and Numbers.

If anybody can suggest me some better alogrithm to scramble strings which will not affect the 1)Performance, 2)Is irreversible, 3) is not very simple & which can even work for Oracle and Sql Server. I understand this forum is just for Mainframes but we are looking for an aproach will can be global and can be applied irrespective of System in question but at the same time we are looking for the solution in Mainframes.

Thanks Again! Please feel free to provide your inputs on the same.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8117
Location: East Dubuque, Illinois, USA

PostPosted: Wed Jul 16, 2008 11:02 pm    Post subject:
Reply with quote

Quote:
If anybody can suggest me some better alogrithm to scramble strings which will not affect the 1)Performance, 2)Is irreversible, 3) is not very simple & which can even work for Oracle and Sql Server. I understand this forum is just for Mainframes but we are looking for an aproach will can be global and can be applied irrespective of System in question but at the same time we are looking for the solution in Mainframes.
You need to decide which of these goals are most important, since "not very simple" conflicts with "not affect the (p)erformance". What you're looking for is asynchronous encryption, such as PGP. But unless you're very skilled already in encryption coding, be prepared to spend some money for a product to do the encryption.
Back to top
View user's profile Send private message
simmimahajan

New User


Joined: 27 Mar 2007
Posts: 30
Location: USA

PostPosted: Wed Jul 16, 2008 11:05 pm    Post subject: Reply to: How to Split, Swap and Reverse a string using Sort
Reply with quote

I understand there is a trade off. But it should be relatively complex, not easily deducible. But performance is important as well coz we may deal with millions of records. Moreover client is not ready to invest in any external products, hence this option is ruled out.

Thanks for the quick reply!
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Jul 17, 2008 12:26 am    Post subject:
Reply with quote

Hello,

Once encrypted, how would the "new" records be used?

If the data is in some database (Mainframe, UNIX, Win-Based) why does the security rules of that database not provide what you need to secure the data?

Possibly i misunderstand where the data is to be encrypted. . .
Back to top
View user's profile Send private message
simmimahajan

New User


Joined: 27 Mar 2007
Posts: 30
Location: USA

PostPosted: Thu Jul 17, 2008 12:42 am    Post subject: Reply to: How to Split, Swap and Reverse a string using Sort
Reply with quote

Hello Dick,

Data will be loaded in QA for testing but we need to achieve this scrambling before data is loaded in to QA from actual live production region(i.e. Mainframe Prod to QA Prod database, Sql Prod database to Sql Prod and so on]. Currently we do not have any such process in place, hence this new process.

Hope this answers your queries. Let me know if there is some disconnect.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Jul 17, 2008 12:51 am    Post subject:
Reply with quote

Hello,

Quote:
we need to achieve this scrambling before data is loaded
Why?

If the data is srambled before the load, it will likely be useless for processing transactions or other queries?

If the data is load "normally" why would the permissions for the database environment not suffice to protect the data?

There must be something i am missing. . . icon_redface.gif
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10274
Location: italy

PostPosted: Thu Jul 17, 2008 2:41 pm    Post subject: Reply to: How to Split, Swap and Reverse a string using Sort
Reply with quote

instead of scrambling with a home grown algorithm which will give very poor statistical uniqueness

why don' t You look into using a checksumming algorithm

just do a little research ( MD5 SHA ... ) just to name a couple
Back to top
View user's profile Send private message
simmimahajan

New User


Joined: 27 Mar 2007
Posts: 30
Location: USA

PostPosted: Thu Jul 17, 2008 10:57 pm    Post subject: Reply to: How to Split, Swap and Reverse a string using Sort
Reply with quote

Hello,

Yes, we are still working on options, but something which can be developed and easily maintained is what we are looking for.

But would like to thank you for your suggestion.

Thanks Again!
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Jul 17, 2008 11:28 pm    Post subject:
Reply with quote

simmimahajan,

A cobol program can written in less than an hour to do what you want.

1. get the length of the string(fname/lname) using Using Inspect function reverse checking for leading spaces and once you get the length divide it into half and use reference modification to move the desired length

2. Function Reverse lets you reverse the string.

3. Concatenate 2 strings and perform the reverse again
Back to top
View user's profile Send private message
simmimahajan

New User


Joined: 27 Mar 2007
Posts: 30
Location: USA

PostPosted: Fri Jul 18, 2008 1:25 am    Post subject: Reply to: How to Split, Swap and Reverse a string using Sort
Reply with quote

Thanks Skolusu! We are working on similar approach and may finalize on using Cobol for scrambling.

Thanks Again!
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10274
Location: italy

PostPosted: Fri Jul 18, 2008 2:01 pm    Post subject: Reply to: How to Split, Swap and Reverse a string using Sort
Reply with quote

In my previous reply I had misunderstood Your requirement..

What You are asking for is commonly called data masking/obfuscation

search google with "data obfuscation" and You will get lots of links

as usual, when I answer, I tend to point out the organizational, security, auditing, certification issues

that' s why for sensitive data manipulation I usually advice against home grown algorithm
they seldom pass an audit/security process

for an issue like this one usually Higher management should be involved,
in many countries they bear legal responsibilities for data mishandling and improper diffusion

that' s why a certified approach would be safer

just being picky,
an algorithm which gives as result the same number of bytes as the source
is seldom irreversible
Back to top
View user's profile Send private message
simmimahajan

New User


Joined: 27 Mar 2007
Posts: 30
Location: USA

PostPosted: Fri Jul 18, 2008 6:27 pm    Post subject: Reply to: How to Split, Swap and Reverse a string using Sort
Reply with quote

Thanks Enrico for all your help! We are exploring different possibilities.
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 SORT to unpack a feild shr_amar DFSORT/ICETOOL 7 Fri Jul 07, 2017 4:32 am
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am
No new posts Optimize sort inrec parse vishwakotin DFSORT/ICETOOL 6 Mon Jun 26, 2017 11:15 pm
No new posts Reduce CPU Times for Join Sort santoshn SYNCSORT 12 Sat Jun 10, 2017 1:40 pm
No new posts Db2 load job abending in SORT mistah kurtz DB2 4 Mon Jun 05, 2017 3:58 pm


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