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

How to convert unsigned numeric to signed packed decimal.


IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
mftechie123

New User


Joined: 20 Jan 2015
Posts: 3
Location: India

PostPosted: Thu Jan 29, 2015 4:54 pm
Reply with quote

Hi,
I have an input file having below fields
X pic 9(10)
Y pic 9(15)
Z pic 9(9)

I need to convert the above fields into signed packed decimal for 2 fields Y and Z and X as Binary format.

INput file doesnt have any signs. THis needs to be converted before passing to further existing downstream process in mainframe.
I tried converting the above fields, but PD values are populated as F, but it should be C.
I tried using below logic.

OUTREC=(1,10,ZD,TO=BI,11,15,ZD,TO=PD,26,9,ZD,TO=PD)

Could you please suggest me how to do this logic using DFSORT.
Back to top
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1306
Location: Vilnius, Lithuania

PostPosted: Thu Jan 29, 2015 5:05 pm
Reply with quote

Both C and F signs are positive, and it would be pretty dumb if the downstream process actually complained about it. PL/I definitely wouldn't.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Jan 29, 2015 5:23 pm
Reply with quote

For COBOL there is compile option NUMPROC. If using NUMPROC(PFD), which generates less code, you have to guarantee that data conforms to PICture.

Can you show some sample input and expected output and what you are actually getting.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Thu Jan 29, 2015 8:12 pm
Reply with quote

DFSORT Application Programming Guide wrote:
TRAILERx, HEADERx, BUILD, OVERLAY, IFTHEN BUILD, IFTHEN OVERLAY and OUTREC now allow you to use new TO=PDF and TO=PDC options to convert numeric values to PD values with F or C for the positive sign, respectively. The TO=PDC option is equivalent to the existing TO=PD option.

So, according to the documentation, you should have a sign (unless you have a version of DFSORT older than V1R13).
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Jan 29, 2015 10:17 pm
Reply with quote

...equivalent to the existing TO=PD, so DFSORT has been like that since TO=PD existed.

SyncSort, however, has a TO=PDC which gives a different result to TO=PD. So, I suspected SyncSort... and think I'll move it along.
Back to top
View user's profile Send private message
mftechie123

New User


Joined: 20 Jan 2015
Posts: 3
Location: India

PostPosted: Fri Jan 30, 2015 8:56 am
Reply with quote

Input file has
Column 1 to 10 has tobe converted to Binary
Column 11 to 25 has tobe converted to Packed decimal
Last column is also to be converted to Packed decimal.

0922489216012240000000096001224118
2004374016012240000000097001224119
0705605376012240000000098001224120


Output file in hexdecimal format..


3F180240000601218
6C101200009F0241F

77500240000701219
78201200009F0241F

20A00240000801210
AEF01200009F0242F

I can able to convert into Binary format. But PD is getting the value as F in sign portion. Suggest me how to get 'C' in sign bit.
Back to top
View user's profile Send private message
mftechie123

New User


Joined: 20 Jan 2015
Posts: 3
Location: India

PostPosted: Fri Jan 30, 2015 9:02 am
Reply with quote

Thanks Bill!! I tried using TO=PDC, Now I got C in sign bit. Thanks a lot for your help.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Mon Feb 02, 2015 2:52 am
Reply with quote

icon_evil.gif Next time, put your Syncsort questions in the Syncsort section !
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 -> SYNCSORT

 


Similar Topics
Topic Forum Replies
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts PD not working for unsigned packed JO... DFSORT/ICETOOL 5
No new posts Def PD not working for unsigned packe... JCL & VSAM 3
No new posts Keep leading zero(s) after convert fl... SYNCSORT 7
Search our Forums:

Back to Top