Joined: 07 Mar 2008 Posts: 5 Location: Bromont, Quebec
Hi...
Sorry for the title, I ask to somes peoples here and they cannot explain me whats it that format.. So, we extract data from an IMS database. We transform this data and after that we load this data in DB2. Somes fields are in a strange format (please tell me if you know the name of this format). We need to transform theses fields (characters fields and packed decimal fields) to a standard format. In my mind, I named theses formats : high value formats.
I success to transform the packed decimal fields... For a packed decimal field, all we have to do is to take 9999999 and substract from this number what I have in this field.
Input :
For charater field, I don't figure how to do it... I know the logic... I could do this in REXX... I take the hexadecimal high value FF and subtract from this the hexadecimal value of a character. And I will have to do this for each character of my field. But I want to do this in DFSORT instead of REXX.
So if you have an idea, please tell me... Also, it's my first I post here, so if you think I put too much information of not enough please tell me, I will try to do better next time.
I am sorry, but Your explanation is not clear at all,
I would start from the copy books that describe the segments layout,
after having a clear picture of the layout everything should come out easily!
Code:
i.Ì%
481764
0998C0
the thing at least in the first five bytes is the packed positive number 408919786
the c in the right lower nibble is the sign
and the rigthmost x'40' is a blank, butas I said before only the copybook will tell what is what !
one thing I do not understand is why take the complement...
it' s not binary math were a negative is stored in two complements..
please be a bit more specific, by posting a couple of fileds and the relative cobol/... declarations
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
Quote:
I take the hexadecimal high value FF and subtract from this the hexadecimal value of a character. And I will have to do this for each character of my field. But I want to do this in DFSORT instead of REXX.
The following DFSORT conctrol cards will give you the desired results. I assumed that your input is 80 bytes and FB recfm.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Quote:
I take the hexadecimal high value FF and subtract from this the hexadecimal value of a character. And I will have to do this for each character of my field. But I want to do this in DFSORT instead of REXX.
You don't have to do it one byte at a time. You can do it 8 bytes at a time like this (8+8+3 = 19):
Joined: 07 Mar 2008 Posts: 5 Location: Bromont, Quebec
Hi Enrico, thanks for the welcome.
Sorry but I haven't any copybook. All that I have, is an executable PL/I code. So no source code of how it is doing. I've check the input, and the output and I've tried to figure out what the transform is. It is also why I try to explain the logic I see.
For the packed decimal, it is working. I put this example to show you what I've done so far. We really take 9999999 minus the extracted field and the result is what we need.
Like I said, this is OK. Maybe mores explanations will help you understand what we do with the PD field. It is what we extract from IMS via Data Refresher. We transform this field with the new DFSORT code I post previously. I gave me for example 1080213. First character is 0 indicating that the century is 19. If I see 1, the century is 20. (Maybe olders of you know the COPICS application, this is how they resolve Y2K) Next step, I execute the following code. (It was another PL1 code that I just replaced) :
This will give me 2008-02-13. I load this field in DB2. Maybe it could be done in one pass. But I don't want to do for this time. It's a big process for plenty of tables. I just want to eliminate PL1 codes I haven't the source code.
Like he said... For the packed decimal, all is working. If you knew a better way to do this feel free to tell me. Maybe the format is like you said a complement ? If I understand, they are stored as complement in IMS so I need to transform them to load them in DB2.
My problem, is that i need to take 'the complement' of characters fields. Here mores lines for the CH fields...
Take each character of the input field. Substract the hexadecimal value of the character from the hexadecimal value FF. This will give me the needed result.
Hope this will help.
I was thinking that showing character preceding my field and coming after will help you determining the boundary. Maybe it's not a good idea ?
Joined: 07 Mar 2008 Posts: 5 Location: Bromont, Quebec
Thanks to you Frank, Skolusu and Enrico for your help
And Frank... Taking FF and substracting each character was a logic I implemented in REXX to understand how it work. It was taking much processing power. So I try it in DFSORT. I was very impressed from the result.
I will try what you and Skolusu tell me and will tell you how it is working
Yess! I might even have worked with the person who was the brain of the whole thing
Is it possible that the COPICS You are using had it' s origin in Italy in the seventies ??
There was a laboratory who developed the COPICS application in italy in Rome IIRC about 35/40 years years ago,
but I do not remember if the same product was exported abroad
if that is the case
The Brain of the whole thing was a colleague of mine, was just the type of person to store the data in the most cryptic way
I became the account SE of his largest customer
when he left the IBM branch office for the development laboratory
Joined: 07 Mar 2008 Posts: 5 Location: Bromont, Quebec
Quote:
Is it possible that the COPICS You are using had it' s origin in Italy in the seventies ??
Don't know, I was not even born at this time But it is really possible... A lot of variables seems to be a mix of english-italien language. Like COUNTER-UNO, LINE-TRATTI. And yes we have IBM products because we are in the micro electronic division of IBM.
But hey... Really... Maybe the data is store in a cryptic way but it is working really great. No loss of performance since all that time.