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 

Sort Utility to convert

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


Joined: 24 Mar 2006
Posts: 6
Topics: 2

PostPosted: Tue Jun 06, 2006 8:24 am    Post subject: Sort Utility to convert Reply with quote

Hi,
Please let me know the sort option or other utility to convert zoned decimal positive value to negative value.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Tue Jun 06, 2006 8:43 am    Post subject: Reply with quote

Deepika,

You need to provide us with details. Show us a sample input and desired output. Also explain what exactly you mean by convert as zoned decimals have a sign ovepunched on the last byte.

Kolusu
_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Deepika
Beginner


Joined: 24 Mar 2006
Posts: 6
Topics: 2

PostPosted: Tue Jun 06, 2006 9:03 am    Post subject: Reply with quote

For eg: Amount field is 15.35 then internally in mainframe it is stored as
Positive Value is stored as : FFFFFFFFFFF
00000001535
Negative value is stored as : FFFFFFFFFFD
00000001535


We need the Sort utility function to convert the X'F' to X'D' ( Last half byte), hence the Zoned decimal amount field will be converted to Negative amount.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Tue Jun 06, 2006 9:10 am    Post subject: Reply with quote

Deepika,

Is your input field a packed decimal ? You say zoned decimal but your data shows a packed decimal data(comp-3) . only packed decimal fields have the sign in the last nibble X'F' & X'C' represent Positive values and X'D' represents negative value.

Just tell me the cobol declaration of the input field and desired output field.

Kolusu
_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Deepika
Beginner


Joined: 24 Mar 2006
Posts: 6
Topics: 2

PostPosted: Tue Jun 06, 2006 9:46 am    Post subject: Reply with quote

Thanks for the quick response,Kolusu.
The COBOL Declaration for Input field is S9(18)V9(2) Comp-3.
The output should be in the same format but multipied with -1.
Please let me know if there is any sort option for the same.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Tue Jun 06, 2006 10:14 am    Post subject: Reply with quote

Deepika,

Assuming that you only wanted to convert positive values to negative values , the following jcl will give you the desired results. I assumed that your input field to be changed starts from position 1. S9(18)V9(2) Comp-3 occupies 11 bytes.


Code:

//STEP0100 EXEC PGM=SORT                                 
//SYSOUT   DD SYSOUT=*                                   
//SORTIN   DD DSN=YOUR INPUT FILE,
//            DISP=SHR                   
//SORTOUT  DD DSN=YOUR OUTPUT FILE,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,
//            SPACE=(CYL,(X,Y),RLSE)
//SYSIN    DD *
 SORT FIELDS=COPY                                       
 OUTREC IFTHEN=(WHEN=(01,11,PD,GT,0),                   
            OVERLAY=(-1,MUL,1,11,PD,PD,LENGTH=11)),     
        IFTHEN=(WHEN=NONE,OVERLAY=(01,11))               
/*


Hope this helps...

Cheers

Kolusu

Ps: The next time please be clear with the questions.
_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Tue Jun 06, 2006 11:28 am    Post subject: Reply with quote

Hmmm ... I took the values to be:

Code:

Positive Value is stored as :
FFFFFFFFFFF
00000001535

Negative value is stored as :
FFFFFFFFFFD
00000001535


which would be ZD. I don't understand how that can be interpreted as PD.
Of course, if it is PD, it really doesn't look like that.

The same question was asked on another board and this is the response I gave:

You can do that with DFSORT by multiplying by -1.

Let's assume you have an 11-byte ZD field starting in position 21.

If you only have positive ZD values, you can use:

Code:

  OPTION COPY
  INREC OVERLAY=(21:21,11,ZD,MUL,-1,TO=ZD,LENGTH=11)


If you have both positive and negative ZD values and you only want to change the positive values to negative values, you can use:

Code:

  INREC IFTHEN=(WHEN=(21,11,ZD,GE,+0),
        OVERLAY=(21:21,11,ZD,MUL,-1,TO=ZD,LENGTH=11))

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
kolusu
Site Admin
Site Admin


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

PostPosted: Tue Jun 06, 2006 12:57 pm    Post subject: Reply with quote

Quote:

I don't understand how that can be interpreted as PD.
Of course, if it is PD, it really doesn't look like that.



Frank,

The last post from deepika is this

deepika wrote:

Thanks for the quick response,Kolusu.
The COBOL Declaration for Input field is S9(18)V9(2) Comp-3.
The output should be in the same format but multipied with -1.
Please let me know if there is any sort option for the same.


I agree that the first initial posts are confusing , but I guess some people have hardtime understanding the basic differences zoned/binary/packed formats.

Kolusu
_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Tue Jun 06, 2006 2:03 pm    Post subject: Reply with quote

Quote:
The COBOL Declaration for Input field is S9(18)V9(2) Comp-3.


Yes, I know deepika said that. My point was that the declare doesn't match the data he showed on both boards. So either he pulled the data he showed out of a hat, or he pulled the COBOL declare he showed out of a hat. Hard to tell which it is. At any rate, I think we've covered all the cases.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
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