View previous topic :: View next topic
|
Author |
Message |
umanaga
New User
Joined: 09 Apr 2007 Posts: 33 Location: India
|
|
|
|
i have a requierement to change S9V99 to S99V999 in sort. Can someone tell if its possible
Ip is like
o/p is to be
Code: |
A 0100}
B 0121}
C 0002} |
|
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Taking an extra byte, try something like:
Code: |
1,2,PD,MUL,+10,TO=PD,LENGTH=3 |
|
|
Back to top |
|
|
umanaga
New User
Joined: 09 Apr 2007 Posts: 33 Location: India
|
|
|
|
i have tried and leading zeroes are are not present. Any help? |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
What do you mean the leading zeros are not present? You've looked at the file in hex and see what? Or are you trying to "display" it for a human? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
What did you get as output (please show in hex).
The topic mentions ZD, but the sample code shows PD. Which have you tried? |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Yoy, you're so right Dick. Didn't even notice after the second post, sorry about that. |
|
Back to top |
|
|
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
umanaga,
umanaga wrote: |
i have a requierement to change S9V99 to S99V999 in sort. |
What does this suppose to mean? What you asked for conversion ( leading zero) but the example you show is NOT leading zeros.
What do you need? Do you need to mutiply with 10 (10} to 0100}) or leading zero (10} to 0010})? Use below method based on your req.
p,m,f,to=f,length=n. In your example if i am not wrong, your input is ZD starting at 3rd position,so you would need 3,3,ZD,TO=ZD,LENGTH=5. This would add leading zeros and produce something like below for the input you have shown...
If you want to multiply with 10, you would need 3,3,ZD,MUL,+10,TO=ZD,LENGTH=5 and produce something like below for the input you have shown...
Thanks, |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
umanaga wrote: |
i have a requierement to change S9V99 to S99V999 in sort. Can someone tell if its possible
Ip is like
o/p is to be
Code: |
A 0100}
B 0121}
C 0002} |
|
umanaga,
Something doesn't make sense here
Quote: |
10} = -100 and 0100} = -1000 OK ( multiply by 10)
12A = +121 and 0121} = -1210 How did a positive value become negative?
00B = +2 and 0002} = -20 Same as above |
You need to define the rules to get that output |
|
Back to top |
|
|
umanaga
New User
Joined: 09 Apr 2007 Posts: 33 Location: India
|
|
|
|
oops..sorry i used wrong sign
o/p is to be
Code: |
A 0100{
B 0121{
C 0002{ |
approach suggested by sqlcode1 is working..thanks |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Code: |
OPTION COPY
INREC OVERLAY=(3:3,3,ZD,MUL,+10,TO=ZDC,LENGTH=4)
|
would give this output:
Code: |
A 100}
B 121{
C 002{
|
Is that what you want? |
|
Back to top |
|
|
umanaga
New User
Joined: 09 Apr 2007 Posts: 33 Location: India
|
|
|
|
yes. Thanks. |
|
Back to top |
|
|
|