View previous topic :: View next topic |
Author |
Message |
jim haire Beginner
Joined: 30 Dec 2002 Posts: 140 Topics: 40
|
Posted: Mon Apr 30, 2012 10:26 am Post subject: Conversion of alphabetic to COMP-3 |
|
|
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 |
|
 |
Sqlcode Intermediate
Joined: 15 Dec 2006 Posts: 157 Topics: 38
|
Posted: Mon Apr 30, 2012 11:01 am Post subject: |
|
|
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 |
|
 |
papadi Supermod
Joined: 20 Oct 2009 Posts: 594 Topics: 1
|
Posted: Mon Apr 30, 2012 2:41 pm Post subject: |
|
|
Hello,
What should happen if the field does not contain a valid value? _________________ All the best,
di |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Mon Apr 30, 2012 6:49 pm Post subject: |
|
|
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 |
|
 |
jim haire Beginner
Joined: 30 Dec 2002 Posts: 140 Topics: 40
|
Posted: Tue May 01, 2012 7:37 am Post subject: |
|
|
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 |
|
 |
Anuj Dhawan Intermediate
Joined: 19 Jul 2007 Posts: 298 Topics: 7 Location: Mumbai,India
|
Posted: Wed May 02, 2012 4:15 am Post subject: |
|
|
Please help me to understand the significance of "(1,14,C'--" . I miss to comprehend it. _________________ Regards,
Anuj |
|
Back to top |
|
 |
Sqlcode Intermediate
Joined: 15 Dec 2006 Posts: 157 Topics: 38
|
Posted: Wed May 02, 2012 10:15 am Post subject: |
|
|
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 |
|
 |
Anuj Dhawan Intermediate
Joined: 19 Jul 2007 Posts: 298 Topics: 7 Location: Mumbai,India
|
Posted: Thu May 03, 2012 9:13 am Post subject: |
|
|
Thanks Sqlcode. That's what I was asking.
Which SQLCODE is your favourite?  _________________ Regards,
Anuj |
|
Back to top |
|
 |
|
|