View previous topic :: View next topic
|
Author |
Message |
Emile Straker
New User
Joined: 27 Mar 2013 Posts: 3 Location: United Kingdom
|
|
|
|
I'm converting a field from ZD with last character signed to a signed numeric field.
The following converts my 10 digit ZD to signed numeric ok:
Code: |
OPTION COPY
OUTREC BUILD=(1,10,ZD,EDIT=(STTTTTTTTTT),SIGNS=(+,-,,)) |
where values are converted from --> to
Code: |
123456789{ --> +1234567890
999999999I --> +9999999999
888888888H --> +8888888888
777777777G --> +7777777777
666666666F --> +6666666666
555555555E --> +5555555555
444444444D --> +4444444444
333333333C --> +3333333333
222222222B --> +2222222222
111111111A --> +1111111111
000000000{ --> +0000000000
123456789} --> -1234567890
999999999R --> -9999999999
888888888Q --> -8888888888
777777777P --> -7777777777
666666666O --> -6666666666
555555555N --> -5555555555
444444444M --> -4444444444
333333333L --> -3333333333
222222222K --> -2222222222
111111111J --> -1111111111
000000000} --> -0000000000 |
But I'm struggling to convert back from the signed numeric to ZD
The following converts the negative values ok, but doesn't change the last character of the positive ones;
Code: |
OPTION COPY
OUTREC BUILD=(1,11,SFF,TO=ZD,LENGTH=10) |
I get:
Code: |
+1234567890 --> 1234567890
+9999999999 --> 9999999999
+8888888888 --> 8888888888
+7777777777 --> 7777777777
+6666666666 --> 6666666666
+5555555555 --> 5555555555
+4444444444 --> 4444444444
+3333333333 --> 3333333333
+2222222222 --> 2222222222
+1111111111 --> 1111111111
+0000000000 --> 0000000000
-1234567890 --> 123456789}
-9999999999 --> 999999999R
-8888888888 --> 888888888Q
-7777777777 --> 777777777P
-6666666666 --> 666666666O
-5555555555 --> 555555555N
-4444444444 --> 444444444M
-3333333333 --> 333333333L
-2222222222 --> 222222222K
-1111111111 --> 111111111J
-0000000000 --> 000000000} |
I have trawled what manuals I have access to, along with the forums but to no avail.
Any help with this matter would be greatly appreciated! |
|
Back to top |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1306 Location: Bamberg, Germany
|
|
|
|
Code: |
OUTREC BUILD=(1,11,CSF,TO=ZDC,LENGTH=10) |
See also OPTION ZDPRINT or NZDPRINT |
|
Back to top |
|
|
Emile Straker
New User
Joined: 27 Mar 2013 Posts: 3 Location: United Kingdom
|
|
|
|
Joerg.Findeisen wrote: |
Code: |
OUTREC BUILD=(1,11,CSF,TO=ZDC,LENGTH=10) |
See also OPTION ZDPRINT or NZDPRINT |
Joerg you're a star!
I had seen ZDC but discounted it, as it seemed to infer that it would use C for positive & D for negative values (which my shop uses all the time for packed decimal stuff) - I did try ZDF which obviously didn't work either!
As for CSF ... that didn't even come across my radar!
Thanks again |
|
Back to top |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1306 Location: Bamberg, Germany
|
|
|
|
SORT never let's us down it seems. |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3075 Location: NYC,USA
|
|
|
|
I second all of that 😀 |
|
Back to top |
|
|
|