|
|
| Author |
Message |
lokeshwar_manoharan
New User
Joined: 22 Sep 2008 Posts: 31 Location: Chennai,Tamilnadu
|
|
|
|
Hi,
When I convert S9(9) variable using sort step using
(1,4,BI,M11) it is converting to 09(9)
ie eg -111111111 is converted to 0111111111
Is there any method to reject the sign and have only 9 character
111111111 ?
Thanks,
Lokesh |
|
| Back to top |
|
 |
References
|
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4579 Location: San Jose, CA
|
|
|
|
Wow, could your post have been any more confusing if you tried?
S9(9) is a ZD format field, so why are you using BI instead of ZD?
What do you mean by "reject the sign"? Do you want to use the absolute value (e.g. -1 -> 1?).
I can't make heads or tails of what you want to do.
Show an example of your input values (in hex) and what you expect the output values to look like. Indicate the correct format for the input values (BI? ZD?). |
|
| Back to top |
|
 |
lokeshwar_manoharan
New User
Joined: 22 Sep 2008 Posts: 31 Location: Chennai,Tamilnadu
|
|
|
|
No its not hexa value, it is S9(9) comp. Binary value
Yes -1 should be converted to 1 with one byte and not 2 bytes
I know we can get the values by having one more sort step. But is there
any way without using another sort step ?
Regards,
Lokeshwar |
|
| Back to top |
|
 |
hchinnam
Active User
Joined: 18 Oct 2006 Posts: 68
|
|
|
|
| lokeshwar_manoharan wrote: |
No its not hexa value, it is S9(9) comp. Binary value
|
Go to your dataset where you have this S9(9) in ISPF view mode. Type Command HEX on. Then your data looks something like below.
| Code: |
000001 TESTING
0240ECEECDC444444444444444444444444444444444
15003523957000000000000000000000000000000000
|
Post your data in this format.
But by the looks of it You have data in BI format and you don't want to change data type. Instead you want to change all negative data to positive.
Am i correct. |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4579 Location: San Jose, CA
|
|
|
|
Lokeshwar,
You still haven't made it clear what you want to do or shown an example of input and expected output values.
S9(9) COMP is a 4-byte FI field. If you want to get the absolute value of the field, you can multiply it by -1. If you want the output value to be 4-byte BI (no sign), you can use these DFSORT statements:
| Code: |
OPTION COPY
INREC OVERLAY=(1,4,FI,MUL,-1,TO=BI,LENGTH=4)
|
If you want the output value to be something else (ZD? another form?), you have to say exactly what you want it to look like. Again, examples of input values and expected output values would help. |
|
| Back to top |
|
 |
lokeshwar_manoharan
New User
Joined: 22 Sep 2008 Posts: 31 Location: Chennai,Tamilnadu
|
|
|
|
Input:
First 4 Bytes -> S9(9) COMP
5th Byte -> X(1)
Last two Bytes -> S9(4) COMP
É8J1
07FDF00
8181101
--------
É8J1
07FDF00
8181102
--------
É8J1
07FDF00
8181103
By using the sort ,
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL FILES=1,
OUTREC=(1,4,BI,M11,5,1,6,2,BI,M11)
//*
I am getting as output(16 Bytes)
0141686993100001
0141686993100002
0141686993100003
Here zeroes are added in the place of Sign (See 1st and 12th position)
Instead of this I need to get as output (14 Bytes)
14168699310001
14168699310002
14168699310003
I know it is possible by having one more sort step by selecting appropriate
fields,
I want to know is there any mask pattern or any way to change as such without extra sort step |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4579 Location: San Jose, CA
|
|
|
|
| Quote: |
| Here zeroes are added in the place of Sign (See 1st and 12th position) |
No, that's not why you have the leading zeros. You have them because you didn't specify a length for the M11 mask, so the default length is used.
If you want a specific length for the M11 masks, you have to specify that length. Now that you've finally described what you want clearly, I can show you how to get it:
| Code: |
SORT FIELDS=COPY
OUTFIL FILES=1,
OUTREC=(1,4,BI,M11,LENGTH=9,5,1,6,2,BI,M11,LENGTH=4)
|
|
|
| Back to top |
|
 |
lokeshwar_manoharan
New User
Joined: 22 Sep 2008 Posts: 31 Location: Chennai,Tamilnadu
|
|
|
|
Thanks a lot Frank!!
Its working now!!! |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4579 Location: San Jose, CA
|
|
|
|
| Good. Next time it would be better if you just post what you're trying to do with an example of the input and output. Your assumption that the sign was the problem was a red-herring and just increased the number of posts needed to give you the solution. |
|
| Back to top |
|
 |
lokeshwar_manoharan
New User
Joined: 22 Sep 2008 Posts: 31 Location: Chennai,Tamilnadu
|
|
|
|
Frank,
There is another problem
My input file:
First 4 Bytes: S9(9) comp
Fifth Byte: X(1)
6th - 8th Byte: X(3)(Packed decimal format)
| Code: |
tù_1
0AD6F000
63DD1800
--------
tù_1
0AD6F200
63DD1000
--------
tù_1
0AD6F000
63DD1800 |
Sort step:
| Code: |
//SORTOF1 DD DSN=OUTPUT,
// DISP=(MOD,CATLG,DELETE),
// DCB=(*.SORTIN),
// SPACE=(CYL,(10,10),RLSE)
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL FILES=1,
OUTREC=(1,4,BI,M11,LENGTH=9,5,1,6,3,PD,M11)
/* |
This step resulting in S0C7 abend. What could be the reason?
But when I have X(3) (Packed decimal) as first element and when I give
| Code: |
//SORTOF1 DD DSN=OUTPUT,
// DISP=(MOD,CATLG,DELETE),
// DCB=(*.SORTIN),
// SPACE=(CYL,(10,10),RLSE)
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL FILES=1,
OUTREC=(1,3,PD,M11)
/* |
Its working. What could be the error in the previous step? |
|
| Back to top |
|
 |
dick scherrer
Global Moderator
Joined: 23 Nov 2006 Posts: 8643 Location: 221 B Baker St
|
|
|
|
Hello,
Bytes 6-8 are not valid packed-decimal numbers. . .
Neither are bytes 1-3 which you have specified in the job you believe is working (it really isn't running correctly - it is simply not abending). The limited data you have posted accidentally has a valid sign, so you do not recieve an 0c7.
Also, please note that your post has been changed to use the "Code" tag which makes the content more readable. |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4579 Location: San Jose, CA
|
|
| Back to top |
|
 |
lokeshwar_manoharan
New User
Joined: 22 Sep 2008 Posts: 31 Location: Chennai,Tamilnadu
|
|
|
|
Thanks Dick and Frank
In my input the values are showing correctly on making HEX on
| Code: |
Ø
800
000
------------
Ø
800
000
------------
Ø
800
000 |
How to get these values? EG:800000
Do I need to convert to HEX? What is the syntax for conversion?
In the table it is declared as X(3) only |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4579 Location: San Jose, CA
|
|
|
|
If you want to convert X'800000' in positions 1-3 to C'800000', you can use:
|
|
| Back to top |
|
 |
lokeshwar_manoharan
New User
Joined: 22 Sep 2008 Posts: 31 Location: Chennai,Tamilnadu
|
|
|
|
| Thanks!! |
|
| Back to top |
|
 |
|
|
|