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
 

 

Loading Packed Decimal Fields

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: Loading Packed Decimal Fields
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    Post subject:
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    Post subject: Reply to: Loading Packed Decimal Fields
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    Post subject: Re: Reply to: Loading Packed Decimal Fields
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    Post subject: Reply to: Loading Packed Decimal Fields
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    Post subject:
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    Post subject:
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: 186
Location: chennai

PostPosted: Fri Jun 19, 2009 1:01 am    Post subject: Reply to: Loading Packed Decimal Fields
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts loading a Modified Mapset Susanta CICS 2 Tue Mar 14, 2017 5:43 pm
No new posts DFSORT MUL FIELDS tspr52 DFSORT/ICETOOL 16 Fri Mar 03, 2017 11:53 pm
No new posts Joinkeys with decimal scdinesh DFSORT/ICETOOL 3 Fri Feb 10, 2017 4:46 am
No new posts Converting decimal to numeric using I... Balaryan DFSORT/ICETOOL 4 Thu Feb 02, 2017 11:27 pm
No new posts Sort two file having same field, one ... himanshu malik DFSORT/ICETOOL 7 Thu Feb 02, 2017 10:09 am


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