View previous topic :: View next topic
|
Author |
Message |
Debasis Misra Warnings : 1 New User
Joined: 16 Sep 2008 Posts: 72 Location: Bangalore
|
|
|
|
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 |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
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 |
|
|
Debasis Misra Warnings : 1 New User
Joined: 16 Sep 2008 Posts: 72 Location: Bangalore
|
|
|
|
we are loading table through the cobol program only.
what is the "desired format" ? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Thanks Arun
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 |
|
|
Debasis Misra Warnings : 1 New User
Joined: 16 Sep 2008 Posts: 72 Location: Bangalore
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
mambopras
New User
Joined: 11 Nov 2008 Posts: 52 Location: Hyderabad
|
|
|
|
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 |
|
|
akashsr_09
New User
Joined: 10 Apr 2021 Posts: 3 Location: India
|
|
|
|
can't we directly move to 9v9 Comp-3 variable ?
why should we first redefine as 9v9 ? |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2018 Location: USA
|
|
|
|
akashsr_09 wrote: |
can't we directly move to 9v9 Comp-3 variable ?
why should we first redefine as 9v9 ? |
Please, start from reading any COBOL manual.
Otherwise there is no chance to understand the responses. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
another winner here,
resurrecting a 13 years old topic |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3051 Location: NYC,USA
|
|
|
|
akashsr_09 wrote: |
can't we directly move to 9v9 Comp-3 variable ?
why should we first redefine as 9v9 ? |
Please don’t tailgate old posts. |
|
Back to top |
|
|
|