View previous topic :: View next topic
|
Author |
Message |
shaktieswararao.Hazaru
New User
Joined: 25 Sep 2010 Posts: 20 Location: Hyderabad
|
|
|
|
Hi,
we have requirement where in the table the column is defined as integer and in the input file we get the same field as 9(6).
For file comparison we need to convert this s(9) comp to numeric.
Can anyone help us with this.
Originally attached to this topic. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
shaktieswararao.Hazaru,
Please don't "tailgate" an old topic. Your question has been split. I have included a reference to the original topic.
Now to what you mean. 9(9) is "numeric" - so are you saying you want it in such a format that it can be easily-read by a human? Or what? Please take some time to clarify your question. Remember, you know what you want, and we don't, so you have to explain what needs to be done, and what you have tried. |
|
Back to top |
|
|
shaktieswararao.Hazaru
New User
Joined: 25 Sep 2010 Posts: 20 Location: Hyderabad
|
|
|
|
Hi,
The actuall requiremetn is we need to unload the file from the table and to compare it with the input file we get.
In the input file the field MSG-ID = 100001 is declared as PIC 9(6), and in the table the column MSG - ID is defined as S 9(9) COMP. so when we unload the data it is in unreadabel format.
Can we compare s9(9) comp with 9(6)? If not we need to convert s 9(9) comp to integer and then we can compare the values?
I tried to convert the comp value to integer as below, but i'm not getting the exact value. the actual value in the table is 100001
Code: |
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
OUTREC FIELDS=(1,31,28,6,BI,EDIT=(TTTTTT),LENGTH=6) |
output:
Please advice.
Code'd |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
You've been here two years, you should be aware of the Code tags to preserve spacing of anything which requires it.
Code: |
OUTREC BUILD=(1,31,28,4,BI,EDIT=(TTTTTT),LENGTH=6) |
Your COMP PIC S9(9) is four bytes long. You specified it as six. Six is solely the output length that you want. Try the above in place of yours. You should be able to correlate the six-byte value you used to the six-digit answer you got if you do the whole thing as hex-to-decimal (see your PC's calculator) with the hex value you find in those six bytes. Bear truncation in mind.
As to whether you need to convert to compare, it depends. If you are using JOINKEYS, then yes, same length and type, start-position can vary. If you are just comparing in INCLUDE/OMIT/IFTHEN, then no, you don't need to convert. If comparing manually, then yes :-) |
|
Back to top |
|
|
shaktieswararao.Hazaru
New User
Joined: 25 Sep 2010 Posts: 20 Location: Hyderabad
|
|
|
|
Thank you ....
Bill Woodger |
|
Back to top |
|
|
|