IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Issues Converting From ZD to Signed Numeric and Back Again


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Emile Straker

New User


Joined: 27 Mar 2013
Posts: 3
Location: United Kingdom

PostPosted: Wed Apr 03, 2024 10:55 pm
Reply with quote

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
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1337
Location: Bamberg, Germany

PostPosted: Wed Apr 03, 2024 11:54 pm
Reply with quote

Code:
OUTREC BUILD=(1,11,CSF,TO=ZDC,LENGTH=10)

See also OPTION ZDPRINT or NZDPRINT
Back to top
View user's profile Send private message
Emile Straker

New User


Joined: 27 Mar 2013
Posts: 3
Location: United Kingdom

PostPosted: Thu Apr 04, 2024 12:51 am
Reply with quote

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
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1337
Location: Bamberg, Germany

PostPosted: Thu Apr 04, 2024 1:00 am
Reply with quote

SORT never let's us down it seems. icon_wink.gif
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3076
Location: NYC,USA

PostPosted: Sat Apr 06, 2024 1:07 am
Reply with quote

I second all of that 😀
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts MacKinney Batch to CICS upgrade causi... CICS 7
No new posts Issues with VIEW DATASET Command CLIST & REXX 2
No new posts Convert HEX to Numeric DB2 3
No new posts Converting fixed length file to excel... IBM Tools 7
No new posts Converting ASCII values to COMP-3 (ZD... JCL & VSAM 2
Search our Forums:

Back to Top