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

Loading Packed Decimal Fields


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Puspojit

New User


Joined: 10 Mar 2008
Posts: 34
Location: Pune

PostPosted: Tue May 27, 2008 8:21 pm
Reply with quote

Hi,

I have a sequential file where there is a numeric field having data type as
9(03).The file has few other fields as well.
My requirement is to load the data of this file in to a Table where the numeric field has been declared as
NUM_OFFICE DECIMAL(3,0)
Now, when I try to load this file , I get an error
Code:

RECORD (1) WILL BE DISCARDED DUE TO 'NUM_OFFICE' CONVERSION ERROR


I would like to know if I need to write a seperate COBOL program to
compress the numeric field before Loading or is there an way out in the Load job itself?

Thanks and regards,
Puspojit
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue May 27, 2008 8:25 pm
Reply with quote

How is the field defined in the LOAD control cards?
Back to top
View user's profile Send private message
Puspojit

New User


Joined: 10 Mar 2008
Posts: 34
Location: Pune

PostPosted: Tue May 27, 2008 8:27 pm
Reply with quote

The field is defined as
Code:

NUM_OFFICE POSITION(1:3) DECIMAL PACKED
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue May 27, 2008 8:38 pm
Reply with quote

Puspojit wrote:
The field is defined as
Code:

NUM_OFFICE POSITION(1:3) DECIMAL PACKED


9(3) is not packed try

Code:

NUM_OFFICE POSITION(1:3) DECIMAL
Back to top
View user's profile Send private message
Puspojit

New User


Joined: 10 Mar 2008
Posts: 34
Location: Pune

PostPosted: Tue May 27, 2008 8:43 pm
Reply with quote

Hi Craq,

I tried with
Code:
NUM_OFFICE POSITION(1:3) DECIMAL


But I am getting the same error message.

Regards,
Puspojit
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue May 27, 2008 9:10 pm
Reply with quote

Code:

NUM_OFFICE POSITION(1:3) DECIMAL EXTERNAL


Try reading the DB2 Utility Guide & Reference
Back to top
View user's profile Send private message
Tom Bowman

New User


Joined: 15 Jun 2009
Posts: 3
Location: Minnesota, USA

PostPosted: Thu Jun 18, 2009 8:33 pm
Reply with quote

Try running an UNLOAD (using DSNUPROC), then see what SYSPUNCH thinks the format is for the field. For example (from one of my generated SYSPUNCH outputs):
( "CTL_NBR"
POSITION( 00003:00006) INTEGER (PIC S9(09) COMP)
, "PARTITION_NO"
POSITION( 00007:00008) SMALLINT (PIC S9(04) COMP)
, "TRANSMISSION_YR"
POSITION( 00009:00011) DECIMAL (PIC S9(04) COMP-3)
, "DATE_RCVD"
POSITION( 00031:00040) DATE EXTERNAL (PIC X(10))
NULLIF(00030)=X'FF'
)

Note: SYSPUNCH POSITIONS start in 00003 because UNLOAD generates first 2 bytes.

You have not showed what the input data is like, for example for NUM_OFFICE of 24:
24 ? (Hex'F2F440')
024 ? (Hex'F0F2F4') but not COMP-3/Packed...
X'024C' ? (this would be Packed/COMP-3)

Of the 4 formats shown in the example, only Date would be readable in EBCDIC as Character (eg:'2009-06-18').

You may need a program (or some kind of conversion, SORT can do this) to make 'PIC 9(3) DISPLAY' (3 Bytes) into 'PIC 9(3) COMP-3' (2 bytes).
9(3) DISPLAY VALUE 123 is X'F1F2F3' - 3 Bytes
9(3) COMP-3 VALUE 123 is X'123F' (sign 'F' for initial value, 'C' after math) 2 bytes.
Back to top
View user's profile Send private message
Raghu navaikulam

Active User


Joined: 27 Sep 2008
Posts: 193
Location: chennai

PostPosted: Fri Jun 19, 2009 1:01 am
Reply with quote

Hi Puspojit

Since the field is defined as DECIMAL(3,0) and the data is in the PS file is in external format, you have to use

Code:
NUM_OFFICE POSITION(1:3) DECIMAL EXTERNAL



Regards
Raghu
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 -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts PD not working for unsigned packed JO... DFSORT/ICETOOL 5
No new posts Def PD not working for unsigned packe... JCL & VSAM 3
No new posts Need Help with Packed Decimal Signs DFSORT/ICETOOL 4
No new posts Select a DB2 value in a specific deci... DB2 4
Search our Forums:

Back to Top