Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to convert unsigned numeric to signed packed decimal.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> SYNCSORT
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    Post subject: How to convert unsigned numeric to signed packed decimal.
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

Active Member


Joined: 07 Feb 2009
Posts: 984
Location: Oostende, Belgium

PostPosted: Thu Jan 29, 2015 5:05 pm    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7233

PostPosted: Thu Jan 29, 2015 5:23 pm    Post subject: Reply to: How to convert unsigned numeric to signed packed d
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: 1219
Location: Israel

PostPosted: Thu Jan 29, 2015 8:12 pm    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7233

PostPosted: Thu Jan 29, 2015 10:17 pm    Post subject: Reply to: How to convert unsigned numeric to signed packed d
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    Post subject:
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    Post subject:
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: 1219
Location: Israel

PostPosted: Mon Feb 02, 2015 2:52 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> SYNCSORT All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts Convert +9999999999999.99 to S9(12)V9(3) vnktrrd DFSORT/ICETOOL 8 Thu Nov 17, 2016 8:15 pm
This topic is locked: you cannot edit posts or make replies. Db2 SQL query to convert rows into co... subratarec DB2 5 Thu Nov 17, 2016 4:51 pm
No new posts convert PD to ZD ram_vizag DFSORT/ICETOOL 5 Sat Nov 05, 2016 3:06 am
No new posts Comparing Decimal and CHAR columns rakesh17684 DB2 7 Thu Oct 20, 2016 2:33 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us