Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Moving from X(2) to Decimal(2,1)

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
Debasis Misra
Warnings : 1

New User


Joined: 16 Sep 2008
Posts: 72
Location: Bangalore

PostPosted: Tue Nov 18, 2008 10:35 pm    Post subject: Moving from X(2) to Decimal(2,1)
Reply with quote

I have a cobol varible of Pic Clause X(2) containing values 11, 20,33, Now I want to upload from this varible to DB2 table field of Decimal(2,1). if I will upload the DB2 table directly from X(2) cobol varible, will it store in table 1.1, 2.0,3.3. If not then how it is possible?
Back to top
View user's profile Send private message

Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2287
Location: @my desk

PostPosted: Tue Nov 18, 2008 10:46 pm    Post subject:
Reply with quote

debasis misra,

I dont think you'll be able to load as such from an X(2) variable. One way is to manipulate the data to get it in the desired format and then load the table. BTW,Which utility are you using to load the table?
Back to top
View user's profile Send private message
Debasis Misra
Warnings : 1

New User


Joined: 16 Sep 2008
Posts: 72
Location: Bangalore

PostPosted: Wed Nov 19, 2008 8:59 am    Post subject:
Reply with quote

we are loading table through the cobol program only.
what is the "desired format" ?
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: Wed Nov 19, 2008 9:33 am    Post subject:
Reply with quote

Hello,

In the cobol program, redefine the pic x(2) as a pic 9v9. Use the 9v9 to update the table (after varifying that the value in the field is valid).
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2287
Location: @my desk

PostPosted: Wed Nov 19, 2008 12:08 pm    Post subject:
Reply with quote

Quote:
what is the "desired format" ?

Hello,

You'll have to have the final host variable as COMP-3 type which corresponds to the DB2 DECIMAL.
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: Wed Nov 19, 2008 8:49 pm    Post subject:
Reply with quote

Hello,

Thanks Arun icon_smile.gif

To be more complete. . . .

After redefining the pic x(2) variable to pic 9v9, move the 9v9 redefined variable to a pic 9v9 comp-3 variable which would be named as the host variable for the database update.

Again, you need to make sure the initial input value is valid as anything might be in a pic x field.
Back to top
View user's profile Send private message
Debasis Misra
Warnings : 1

New User


Joined: 16 Sep 2008
Posts: 72
Location: Bangalore

PostPosted: Thu Nov 20, 2008 8:48 am    Post subject:
Reply with quote

Thanks for all suggestion. Its my understanding:

A ---- X(2) --- I/P
B ---- 9V9 Comp-3 --- Host variable.

C --- decimal (2,1) --- DB2 table varible.
===
Move A to B.
Then insert to C from B.

Now If A = 11
Then C = 1.1
===
Please suggest wheather its correct or not?
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: Thu Nov 20, 2008 9:01 am    Post subject:
Reply with quote

Hello,

Personally, i'd suggest:
A ---- X(2) --- I/P
A-REDEF REDEFINES 9v9 (redefinition of i/p)

B ---- 9V9 Comp-3 --- Host variable.

Move A-REDEF to B.
Then insert to C from B.

Then:
If A = 11
Then C = 1.1

Before the move, i'd suggest validating that the i/p is valid - otherwize you may have an oc7 or sql error.
Back to top
View user's profile Send private message
mambopras

New User


Joined: 11 Nov 2008
Posts: 52
Location: Hyderabad

PostPosted: Mon Nov 24, 2008 9:11 pm    Post subject:
Reply with quote

IF we know how the DCL variable is declared for the field in a particular table, we can redefine the working storage variable in such a way right!!! tell me if i am wrong.
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 Moving a COMP-3 Variable to a Numeric... ajayachander COBOL Programming 2 Thu Dec 14, 2017 5:46 pm
No new posts Moving a PS file as body of a mail! Vignesh Sid JCL & VSAM 4 Tue Nov 21, 2017 9:23 pm
No new posts Extend the decimal values in DIVISION Balaryan DFSORT/ICETOOL 3 Thu Oct 05, 2017 4:05 pm
No new posts Moving UDB database to Db2 on z/OS Keith Hooley DB2 4 Wed Sep 27, 2017 12:38 am
No new posts Moving values to a variable of copybo... Vignesh Sid COBOL Programming 6 Wed Sep 06, 2017 1:04 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us