MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Conversion of alphabetic to COMP-3

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
jim haire
Beginner


Joined: 30 Dec 2002
Posts: 140
Topics: 40

PostPosted: Mon Apr 30, 2012 10:26 am    Post subject: Conversion of alphabetic to COMP-3 Reply with quote

Can DFSORT convert an alphabetic field with a decimal point to a packed decimal field? I'd like to convert a field of 14 characters with a
XXXXXXXXX.XXXX format to 9(9)v9(4) comp-3.
Back to top
View user's profile Send private message
Sqlcode
Intermediate


Joined: 15 Dec 2006
Posts: 157
Topics: 38

PostPosted: Mon Apr 30, 2012 11:01 am    Post subject: Reply with quote

jim haire,
Use TO=PD,LENGTH=n to do conversion. Feel free to change BUILD to OVERLAY or anything other function that you need.
Code:
//STEP0001 EXEC PGM=SORT                           
//SORTIN   DD  *                                   
123456789.1234                                     
//SORTOUT  DD  DSN=TESTEZN.DUMMY,                   
//             DISP=(,CATLG,DELETE),               
//             UNIT=SYSDA                           
//SYSIN DD *                                       
  OPTION COPY                                       
  INREC BUILD=(1,14,C'--',1,14,UFF,TO=PD,LENGTH=7) 
/*                                                 
//SYSOUT DD SYSOUT=*                               
//*

OUTPUT
[code:1:728447bf0f]123456789.1234--
Back to top
View user's profile Send private message
papadi
Supermod


Joined: 20 Oct 2009
Posts: 594
Topics: 1

PostPosted: Mon Apr 30, 2012 2:41 pm    Post subject: Reply with quote

Hello,

What should happen if the field does not contain a valid value?
_________________
All the best,

di
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Mon Apr 30, 2012 6:49 pm    Post subject: Reply with quote

jim haire,


If your input data contains the Signs ( +, - ) then you can use SFF format to convert them to PD.

Papadi,

SFF/UFF will extracts decimal digits (0-9) and signs (+, - ) and any other value is replaced with zero
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
jim haire
Beginner


Joined: 30 Dec 2002
Posts: 140
Topics: 40

PostPosted: Tue May 01, 2012 7:37 am    Post subject: Reply with quote

Thanks for all your responses. The input coming in did not contain a sign, so I ended up using Sqlcode's version.

I will keep the SFF response in case I need this verison in the future. Thanks!
Back to top
View user's profile Send private message
Anuj Dhawan
Intermediate


Joined: 19 Jul 2007
Posts: 298
Topics: 7
Location: Mumbai,India

PostPosted: Wed May 02, 2012 4:15 am    Post subject: Reply with quote

Please help me to understand the significance of "(1,14,C'--" . I miss to comprehend it.
_________________
Regards,
Anuj
Back to top
View user's profile Send private message
Sqlcode
Intermediate


Joined: 15 Dec 2006
Posts: 157
Topics: 38

PostPosted: Wed May 02, 2012 10:15 am    Post subject: Reply with quote

Anuj Dhawan,
First 1,14,c'--', is to keep original values and next one is to do the conversion. This is to show original/input values and converted values on the same line for ease of understanding.

Its not (first one) really needed for conversion if that's what you are asking.

Thanks,
Back to top
View user's profile Send private message
Anuj Dhawan
Intermediate


Joined: 19 Jul 2007
Posts: 298
Topics: 7
Location: Mumbai,India

PostPosted: Thu May 03, 2012 9:13 am    Post subject: Reply with quote

Thanks Sqlcode. That's what I was asking.

Which SQLCODE is your favourite? Smile
_________________
Regards,
Anuj
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group