IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Defining numeric data type in Sort


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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
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
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
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
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

Moderator Emeritus


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

PostPosted: Thu Jul 02, 2009 8:47 pm
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
Reply with quote

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

Moderator Emeritus


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

PostPosted: Thu Jul 02, 2009 9:23 pm
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
Reply with quote

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

DFSORT Developer


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

PostPosted: Thu Jul 02, 2009 9:52 pm
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
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 Developer


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

PostPosted: Thu Jul 02, 2009 10:13 pm
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:

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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to save SYSLOG as text data via P... All Other Mainframe Topics 4
No new posts Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts Store the data for fixed length COBOL Programming 1
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top