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
 

 

Field length of Packed decimal to numeric

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

New User


Joined: 22 Jul 2008
Posts: 3
Location: India

PostPosted: Thu Jan 22, 2009 3:21 pm    Post subject:
Reply with quote

when we are converting Comp-3 field (like PIC S9(9)V99 COMP-3. ) to numeric field what field length do the conveted value occupy?

For comp-3 it was 6 bytes, for output file it won't remain 6 bytes. i tried this conversion, the byte length comes out to be 15 bytes. is it some standard ?????


Thanks!!!!
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8057
Location: East Dubuque, Illinois, USA

PostPosted: Thu Jan 22, 2009 5:48 pm    Post subject:
Reply with quote

Quote:
when we are converting Comp-3 field (like PIC S9(9)V99 COMP-3. ) to numeric field what field length do the conveted value occupy?
This depends on what you want to convert it to. PIC S9(09)V99 USAGE DISPLAY will take 11 bytes. If you want the explicit decimal point in your output field, add a byte for it. If you want a separate sign add a byte for it. So the output field will be 11 to 13 bytes depending on your needs; if you go with DB/CR or other formatting options you could again need to add bytes.

lohithegde: please, please, please learn the difference between a bit and a byte. Your answer is completely wrong because of this difference Referenced post deleted before seeing this clarification. d
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 Jan 22, 2009 9:46 pm    Post subject:
Reply with quote

Quote:
i tried this conversion, the byte length comes out to be 15 bytes. is it some standard ?????


You tried what conversion? What did you code exactly? There are defaults for the output form and length of various conversions, but you can override them.

The real question is what do you want the converted value to look like and what length do you want it to have? Once you decide that, you can use the appropriate statement to do the conversion you want.

If you need help figuring out how to do the conversion you want, show an example of the input values and what you want for output.
Back to top
View user's profile Send private message
gagandeep

New User


Joined: 22 Jul 2008
Posts: 3
Location: India

PostPosted: Tue Jan 27, 2009 10:38 am    Post subject:
Reply with quote

I had two Comp-3 variable in the input file.
PIC S9(9)V99 COMP-3. and PIC S9(11)V99 COMP-3.
I converted these field using the following OUTREC
72,6,PD,M4 and 119,7,PD,M4(first field starting from position 72 and second from 119)
In output file, the the converted value occupy 15 and 18 bytes respectively.

How this length bytes are calculated by the system internally?

Thanks for your Replies......
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: Tue Jan 27, 2009 10:55 am    Post subject:
Reply with quote

Hello,

The length is determined by the length of the PD fields and the M4 mask.

Look here and scroll down to Table 38 - Edit Mask Patterns:
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/handheld/Connected/BOOKS/ice1ca10/3.13?
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: Tue Jan 27, 2009 10:00 pm    Post subject:
Reply with quote

Gags,

Here's how DFSORT determines the output length.

You used an edit mask of M4 which has a pattern of:

SII,III,...,IIT.TT

A 6-byte PD value has a sign and 11 digits (e.g. X'12345678901C'). The 11 digits are substituted for the I and T characters in the M4 pattern from right to left and the sign (+ or -) is substituted for S resulting in:

+123,456,789.01

which is 15 characters.

A 7-byte PD value has a sign and 13 digits (e.g. X'1234567890123C'). The 13 digits are substituted for the I and T characters in the M4 pattern from right to left and the sign (+ or -) is substituted for S resulting in:

+12,345,678,901.23

which is 18 characters.
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 Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts READ A PACKED "NEGATIVE" FI... jdesouza CA Products 3 Tue May 02, 2017 11:43 pm
No new posts Alter &DATENS field in HEADER1 Angad DFSORT/ICETOOL 4 Mon Apr 24, 2017 11:49 am
No new posts Length of Tape file Mohan Kothakota JCL & VSAM 9 Thu Apr 20, 2017 10:24 pm
No new posts Sort Large record length cmsmoon DFSORT/ICETOOL 14 Tue Apr 11, 2017 5:49 pm


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