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 

length in bytes of PIC S9(9) COMP.

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


Joined: 20 Jun 2003
Posts: 9
Topics: 1

PostPosted: Fri Jun 20, 2003 11:51 pm    Post subject: length in bytes of PIC S9(9) COMP. Reply with quote

To MVS Help
Could you please tell me how many bytes a cobol field of PIC S9(9) COMP is ?
It currently defines a data item in a sequential file on the OS 390 mainframe which is four bytes in length.
Could you please confirm that it is 4 bytes in length (without a C at the end to signify a positive sign).
Thanks
Justin Morieson
Back to top
View user's profile Send private message
Glenn
Beginner


Joined: 23 Mar 2003
Posts: 56
Topics: 3

PostPosted: Sat Jun 21, 2003 1:57 am    Post subject: Reply with quote

You have your answer if it occupied 4 bytes in your file.
Back to top
View user's profile Send private message
jlmori
Beginner


Joined: 20 Jun 2003
Posts: 9
Topics: 1

PostPosted: Sat Jun 21, 2003 2:47 am    Post subject: Reply with quote

Thanks
I understand it is 4 bytes in length. However, why is it that the sign is represented in a field defined as PIC S9(9) COMP-3 (packed decimal- 5 bytes in length) and not in a PIC S9(9) COMP ? It seems meaningless to have the 'S' in the PIC clause.
Thanks
Justin
Back to top
View user's profile Send private message
jlmori
Beginner


Joined: 20 Jun 2003
Posts: 9
Topics: 1

PostPosted: Sat Jun 21, 2003 5:31 am    Post subject: Reply with quote

To MVS Forums
Please ignore my last message. After doing further research on MVS Forums cobol links I have found out that a COMP field is actually Binary. Therefore the 'S' in the PIC S9(9) COMP does have internal meaning as the data is stored as either a positive or negative value and is represented as four bytes. The decimal value is not the literal HEX values as in a PACKED-DECIMAL field eg X'000012345C' (stored as PIC S9(9) COMP-3) would represent the decimal number +12345. The number X'00123456' stored as Binary (PIC S9(9) COMP) would compute to a decimal equivalent of +1193046. Similarly a decimal value of -797 stored in a PIC S9(9) COMP would be represented in HEX as 'FFFFFCE3'. These conversions can be done using a Scientific calculator.
Thanks
Justin
Back to top
View user's profile Send private message
slade
Intermediate


Joined: 07 Feb 2003
Posts: 266
Topics: 1
Location: Edison, NJ USA

PostPosted: Sat Jun 28, 2003 10:17 pm    Post subject: Reply with quote

Hi Justin,

It looks like you learned 2 lessons by posting here:

1) You get answers to the question you post. So it behooves one to take care in phrasing the question.

2) The glories of research. Sometimes referred to as RTFM. Smile

Regards, Jack.
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


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

PostPosted: Sun Jun 29, 2003 9:32 am    Post subject: Reply with quote

Justin,

For more information about COBOL data types and DFSORT formats, see the "What are the equivalent DFSORT formats for various COBOL data types?" Ask Professor Sort item at:

http://www.ibm.com/servers/storage/support/software/sort/mvs/professor_sort/
_________________
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


Last edited by Frank Yaeger on Fri Aug 25, 2006 5:56 pm; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
jlmori
Beginner


Joined: 20 Jun 2003
Posts: 9
Topics: 1

PostPosted: Mon Jul 07, 2003 6:29 am    Post subject: Reply with quote

Thanks
I have had a brief look at this link- very interesting.
What does the 'FI' format stand for ?
Justin
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


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

PostPosted: Mon Jul 07, 2003 9:59 am    Post subject: Reply with quote

Justin,

FI is signed fixed point. Negative numbers are in 2's complement form. For example - 2-byte FI: +1 is X'0001' and -1 is X'FFFF'.

For details on all of DFSORT's formats, see Appendix C of "DFSORT Application Programming Guide". You can get to it in the PDF version from:

http://www-1.ibm.com/servers/eserver/zseries/zos/bkserv/r2pdf/dfsort.html
_________________
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 -> Application Programming 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