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

Field length of Packed decimal to numeric


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Jan 22, 2009 5:48 pm
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 Developer


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

PostPosted: Thu Jan 22, 2009 9:46 pm
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
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

Moderator Emeritus


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

PostPosted: Tue Jan 27, 2009 10:55 am
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:
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 Developer


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

PostPosted: Tue Jan 27, 2009 10:00 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
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 How to split large record length file... DFSORT/ICETOOL 10
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top