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
 

 

Defining numeric data type in Sort

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
harsh singh

New User


Joined: 11 Dec 2007
Posts: 26
Location: INDIA

PostPosted: Thu Jul 02, 2009 5:03 pm    Post subject: Defining numeric data type in Sort
Reply with quote

Hi
i tried to dig out the portal for solving my confusion but my effort went in vain, please try to help me.
I have a account number field which is of numeric datatype in my master file , say
ACCT-NO PIC 9(16).

I tried to sort the file on this account no field
Sort card used by me is
SORT FIELDS=(736,16,ZD,A)

to my curiosity i tried sorting the file with below sort card too
SORT FIELDS=(736,16BI,A)
to my surprise the output(sort account no) using both card are same.
I tried to investigate why the output are same for both sort card but could not reach any solution.

I believe the storing technique in memory is different for BI datatype and ZD datatype so either of the one should give errors but this actually did not happened.

Please let me know the correct data type to be used in SORT for numeric data type and what is the possible reason of not encountering any error using above cards( i believe that either of the card suits the requirement).
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Jul 02, 2009 5:20 pm    Post subject:
Reply with quote

Maybe PIC 9(16) is not zoned decimal?
Back to top
View user's profile Send private message
harsh singh

New User


Joined: 11 Dec 2007
Posts: 26
Location: INDIA

PostPosted: Thu Jul 02, 2009 5:36 pm    Post subject:
Reply with quote

pic 9(16) is PIC 9(n) DISPLAY and is of format ZD in DFSORT format
As far as the account no is concerned i believe that they are mapped in memory as type Zoned decimal not Binary.
What does you suggest sir ?
If my understanding is correct and it is of type ZD then Sort card with type as BI should gives error . Please advise.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Jul 02, 2009 5:52 pm    Post subject:
Reply with quote

PIC 9(n) display is nothing but Character or x type, unsigned, which is why the BI works.

ZD is Zoned Decimal, signed

here is the link to the page in the reference manual.

I promised Frank and Kolusu to stay out of DFSORT questions,
but this is sooooooooooooooooooooooooooooooooo basic.
Back to top
View user's profile Send private message
harsh singh

New User


Joined: 11 Dec 2007
Posts: 26
Location: INDIA

PostPosted: Thu Jul 02, 2009 7:56 pm    Post subject:
Reply with quote

thank you dick for coming up with a valid reason,unfortunanetly it did not clicked me.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Jul 02, 2009 8:47 pm    Post subject:
Reply with quote

Hello,

Quote:
If my understanding is correct and it is of type ZD then Sort card with type as BI should gives error . Please advise.
There is a flaw in the understanding. . .

Why would there be an error? Any field may be sorted with BI - what error did you expect?

If all of the values were positive, they would both sort in the same sequence.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Jul 02, 2009 9:14 pm    Post subject:
Reply with quote

there is no signed field involved.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Jul 02, 2009 9:23 pm    Post subject: Reply to: Defining numeric data type in Sort
Reply with quote

Hi Dick,

Quote:
there is no signed field involved.
Good catch - my "processor" read it as s9(16) - d'oh icon_redface.gif

d
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Jul 02, 2009 9:42 pm    Post subject:
Reply with quote

but what you said was true
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Thu Jul 02, 2009 9:52 pm    Post subject:
Reply with quote

ZD is the correct format to use for zoned decimal numeric values. ZD will handle signed and unsigned zoned decimal values correctly.

BI will give the correct results for zoned decimal values as long as they all have the same sign, but may or may not give the correct results if all of the values don't have the same sign.

For example, if we have 2-byte ZD values like this:

Code:

X'F1F2' = +12
X'F1F4' = +14


both ZD and BI will give the correct results.

But if we have 2-byte ZD values like this:

Code:

X'F1F2' = +12
X'F2C4' = +14
X'F1D4' = -14


ZD will give the correct results (because it interprets F and C as plus signs and D as a minus sign), whereas BI will not give the correct results (because it treats the values as unsigned binary).
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Jul 02, 2009 10:02 pm    Post subject:
Reply with quote

Frank,

then what you are saying is that DFSORT considers both:
PIC 9(n)
PIC S9(n)

as zoned decimal.

In that case, I was wrong and owe Harsh an apology.

Harsh,

the reason that both ZD and BI sorted the same in this case
is because the ZD treated the unsigned numeric as positive,
which gives the same output sequence as BI,
as Dick said.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Thu Jul 02, 2009 10:13 pm    Post subject:
Reply with quote

Quote:
then what you are saying is that DFSORT considers both:
PIC 9(n)
PIC S9(n)

as zoned decimal.


Yes. See the following for more information:

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA30/C.3?DT=20080528171007
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Jul 02, 2009 10:27 pm    Post subject:
Reply with quote

thx Frank,

I looked at DFSORT Data Formats instead of DFSORT Formats for COBOL Data Types

my bad. back to making noooo posts in DFSORT forum.
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Is the 'prompt' data for the DSLIST p... Willy Jensen TSO/ISPF 2 Tue Dec 06, 2016 4:38 am
This topic is locked: you cannot edit posts or make replies. How to move a long alphanumeric data ... lind sh COBOL Programming 8 Mon Dec 05, 2016 7:51 pm
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
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 ODPP(Optim Data privacy Provider) Iss... Rama kishore IBM Tools 1 Mon Nov 07, 2016 5:46 pm


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