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
 

 

Moving a big alphanumeric field into a small char field.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
kovur

New User


Joined: 15 Nov 2007
Posts: 37
Location: India

PostPosted: Thu Apr 17, 2008 5:53 pm    Post subject: Moving a big alphanumeric field into a small char field.
Reply with quote

Hi,
I have a code which reads the input file and inserts the record into a table.
Now, I have a field called SCHEME in the file which is of length 20 defined as ALPHANUMERIC.
Now, I need to move this field into the table field which is of length 3 defined as CHAR.
The field SCHEME from the file may contain one word, two words and so on.
Now, the problem is how to move this 20 byte field to a 3 byte field?
We are thinking of moving the first three bytes of the file field but we are getting duplicates which the table will not accept, the table field being a part of the index.

We are also thinking to use the first three bytes if it has one word and use the first byte of each word if the field has more than one word.
But still we are getting duplicate values for the field in this case also.
All this should be done in the code it self.
Please let me know what other ways we can think of.
Back to top
View user's profile Send private message

Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 788
Location: Chennai, India

PostPosted: Thu Apr 17, 2008 6:17 pm    Post subject:
Reply with quote

Poor design/implementation...
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10231
Location: italy

PostPosted: Thu Apr 17, 2008 6:29 pm    Post subject: Reply to: Moving a big alphanumeric field into a small char
Reply with quote

Quote:
Now, the problem is how to move this 20 byte field to a 3 byte field?


if it were possible it would be the nightmare of storage marketing people
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10231
Location: italy

PostPosted: Thu Apr 17, 2008 6:43 pm    Post subject: Reply to: Moving a big alphanumeric field into a small char
Reply with quote

Please clarify Your needs...

there is no way to squeeze into three bytes the info contained in twenty bytes
( unless Shannon had it completely wrong...
if You are interested search for "shannon entropy" )
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 Apr 17, 2008 8:13 pm    Post subject:
Reply with quote

Hello,

Quote:
Now, the problem is how to move this 20 byte field to a 3 byte field?
Sorry, but that is not just a problem - it is not do-able. . .

One alternative is to re-define the table to accomodate the full width of the data.

As was requested before, please clarify excatly what you need to do. Your post does not explain the requirement, but rather a "solution" that does not work.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Thu Apr 17, 2008 8:28 pm    Post subject:
Reply with quote

Well if there was only 999 posible combinations, a table lookup/translate might work....
Or 99999 iif packed decimal....
Or 16777215 if binary.......
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Thu Apr 17, 2008 8:31 pm    Post subject:
Reply with quote

With a 3 byte alphanumeric code you could handle a lot of combinations, it just depends on how may variations there are in that 20 byte field. Sounds like a slight design problem.
Back to top
View user's profile Send private message
kovur

New User


Joined: 15 Nov 2007
Posts: 37
Location: India

PostPosted: Fri Apr 18, 2008 10:22 am    Post subject: Re: Moving a big alphanumeric field into a small char field.
Reply with quote

Hi friends,
Thanks for your response.
I did not expect that the following line can make people confused.
kovur wrote:
Now, the problem is how to move this 20 byte field to a 3 byte field?


In fact, the problem is we have to take 3 bytes from the 20 byte field and move it to the table field which is char(3)
Which 3 bytes to take is the problem.
One more issue is there is a possibility that we may get a new SCHEME name in future. Then, 3 bytes should be taken from that filed and moved to the table.
Please let me know if everything is clear by now or any thing else is needed.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10231
Location: italy

PostPosted: Fri Apr 18, 2008 12:45 pm    Post subject: Reply to: Moving a big alphanumeric field into a small char
Reply with quote

the real question ( not answered yet )
what is the projected usage of these three bytes
given that the mapping of 20 to 3 will never be unique
( unless, as many posters do, You are hiding/not-telling something )
Back to top
View user's profile Send private message
kovur

New User


Joined: 15 Nov 2007
Posts: 37
Location: India

PostPosted: Fri Apr 18, 2008 2:16 pm    Post subject: Reply to: Moving a big alphanumeric field into a small char
Reply with quote

Hi Enrico,
This three byte field will be moved to the table DCLGEN and this along with other fields is used to Update or insert the record in to the table.

Hope I gave the correct answer.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10231
Location: italy

PostPosted: Fri Apr 18, 2008 2:19 pm    Post subject: Reply to: Moving a big alphanumeric field into a small char
Reply with quote

You just told that You are shuffling things around
but not the logic why the application wants to squeeze 20 bytes in 3 bytes
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: Fri Apr 18, 2008 7:34 pm    Post subject:
Reply with quote

Hello,

If you explain the business requirement or rule you need to implement (rather than talking about 20 or 3 bytes), we may be able to offer better suggestions.

So far, most of us do not understand what you need to do.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Mon Apr 21, 2008 7:56 am    Post subject:
Reply with quote

Hi Kovur,

You might try something like this to get your problem across:


Quote:
I have a 20 byte field that looks like this:

(Show the field here)

The 3 bytes I want to move are:

(Show the 3 bytes here)

The position of the 3 bytes will vary from rec to rec; the position in the 20 byte variable might change too, etc., etc.


I'm only guessing at what you may include, but you get the idea.
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts IMS DB-How to update a record (a sing... Nic Clouston IMS DB/DC 9 Thu Mar 09, 2017 4:38 pm
No new posts outrec field outside range Danielle.Filteau SYNCSORT 10 Sat Mar 04, 2017 2:37 am
No new posts 2 byte YEAR from Y'DATE2' field tecnokrat DFSORT/ICETOOL 2 Tue Feb 07, 2017 12:05 pm
No new posts Sort two file having same field, one ... himanshu malik DFSORT/ICETOOL 7 Thu Feb 02, 2017 10:09 am


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