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

moving values from CICS screen to database


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

New User


Joined: 27 Apr 2009
Posts: 8
Location: Bangalore

PostPosted: Mon May 04, 2009 4:00 pm
Reply with quote

In CICS screen I am giving the values as below:-

PLAN NAME vod298
LOCAL CALL RATE 12354
LONG DISTANCE CALL RATE 56879
ISD CALL RATE 45143
MONTHLY RENTAL 215
ROAMING CHARGES 45645
LCL SMS CHARGE 31321
STD SMS CHARGES 23154
ISD SMS CHARGES 65487
FREE CALLS 641
FREE SMS 131

Now I am inserting this values into the database...
When I am checking the database, I am getting the values as below:-

TBS_PLAN_NAME VOD298
TBS_LCALL_RATE 354.00
TBS_SDCALL_RATE 879.00
TBS_ICALL_RATE 143.00
TBS_LSMS_RATE 321.00
TBS_LDSMS_RATE 154.00
TBS_ISMS_RATE 487.00
TBS_RMNG_RATE 645.00
TBS_MNTH_RENTAL 215
TBS_FREE_SMS 131
TBS_FREE_CALLS 641
The problem is that if I am giving value as 12354 it is taking as 354.00
In creating table, I am using the DEC(5,2).

I am not able to understand the reason behind this.

Please give the solution what to do????
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon May 04, 2009 4:13 pm
Reply with quote

what is the definition of your host variables?
Back to top
View user's profile Send private message
hills

New User


Joined: 27 Apr 2009
Posts: 8
Location: Bangalore

PostPosted: Mon May 04, 2009 4:23 pm
Reply with quote

I am not using any host variables.

Directly moving values from CICS to database.
Back to top
View user's profile Send private message
hills

New User


Joined: 27 Apr 2009
Posts: 8
Location: Bangalore

PostPosted: Mon May 04, 2009 4:39 pm
Reply with quote

I tried using the host variables and gave their definition as
PIC 9(3).9(2).

Showing the same values.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon May 04, 2009 4:40 pm
Reply with quote

hills wrote:
I am not using any host variables.

Directly moving values from CICS to database.


sigh**,

do you mean you are using the map definitions?


show us your sql.
Back to top
View user's profile Send private message
hills

New User


Joined: 27 Apr 2009
Posts: 8
Location: Bangalore

PostPosted: Mon May 04, 2009 4:52 pm
Reply with quote

Quote:
I tried using the host variables and gave their definition as
PIC 9(3).9(2).

Showing the same values.



The sql code is as under:

Code:
EXEC SQL
         INSERT INTO TBSPLTR (TBS_PLAN_NAME,
                              TBS_LCALL_RATE,
                              TBS_SDCALL_RATE,
                              TBS_ICALL_RATE,
                              TBS_MNTH_RENTAL,
                              TBS_RMNG_RATE,
                              TBS_LSMS_RATE,
                              TBS_LDSMS_RATE,
                              TBS_ISMS_RATE,
                              TBS_FREE_CALLS,
                              TBS_FREE_SMS)
                      VALUES (:TBS-PLAN-NAME,
                              :TBS-LCALL-RATE,
                              :TBS-SDCALL-RATE,
                              :TBS-ICALL-RATE,
                              :TBS-MNTH-RENTAL,
                              :TBS-RMNG-RATE,
                              :TBS-LSMS-RATE,
                              :TBS-LDSMS-RATE,
                              :TBS-ISMS-RATE,
                              :TBS-FREE-CALLS,
                              :TBS-FREE-SMS)
END-EXEC.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon May 04, 2009 4:54 pm
Reply with quote

try using 9(3)V9(2)
instead of 9(3).9(2)
Back to top
View user's profile Send private message
hills

New User


Joined: 27 Apr 2009
Posts: 8
Location: Bangalore

PostPosted: Mon May 04, 2009 7:41 pm
Reply with quote

I tried using 9(3)V9(2), but the same error.

Below is the display giving CEDF on and then running:-

Code:
EXEC SQL INSERT
   DBRM=TBSPLAN2, STMT=00218, SECT=00001
   IVAR 001: TYPE=CHAR,                 LEN=00006,    IND=000     AT X'2C12A0E0'
             DATA=X'E5D6C4F5F8F7'
   IVAR 002: TYPE=DECIMAL,              LEN=05.02,    IND=000     AT X'2C12A0E6'
             DATA=X'61300C'
   IVAR 003: TYPE=DECIMAL,              LEN=05.02,    IND=000     AT X'2C12A0E9'
             DATA=X'78900C'
   IVAR 004: TYPE=DECIMAL,              LEN=05.02,    IND=000     AT X'2C12A0EC'
             DATA=X'15300C'
   IVAR 005: TYPE=INTEGER,              LEN=00004,    IND=000     AT X'2C12A0FB'
               OFFSET:X'0012B0'    LINE:UNKNOWN        EIBFN=X'1802'



The values here I had given was
1) 45613
2) 15789
3) 64153

It is taking the last 3 digits and then puts zeroes.
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: Mon May 04, 2009 7:48 pm
Reply with quote

OK, the definition is (5,2) and your value is 45613. Let's see ... there is no decimal point in 45613 so the implied decimal point will be after the 3 (absent anything to change that) ... so now we have 45613.00 based on the data definition ... oops, too many characters before the decimal point so let's chop it down and now we have 613.00
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon May 04, 2009 7:52 pm
Reply with quote

ok,


you are losing positions because your decimal alignment is not correct
either because of PIC definition
or your manipulation of the data.

for one field/column for which you are having trouble, please provide
  • the screen input field definition
  • the host variable definition
  • the column defintion


with that info we can provide you some guidance.
Back to top
View user's profile Send private message
Mickeydusaor

Active User


Joined: 24 May 2006
Posts: 258
Location: Salem, Oregon

PostPosted: Tue May 05, 2009 3:40 am
Reply with quote

DEC(5,2). this statement set up for 5 places and 2 of them are the
decimal position. 12345 work then be 123.45. the first postion is the length of the field and the next is the implied decimal.
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: Tue May 05, 2009 3:44 am
Reply with quote

But it depends on what is moving the data; 12345 may be treated as 123.45 or as 345.00 depending. It appears the O/P was expecting the first case and got the second case. Without more details, such as the language being used to interact with the CICS map, that's about all we can say. Both move forms are valid and occur for different languages and variable definitions.
Back to top
View user's profile Send private message
Vishu

New User


Joined: 23 Mar 2009
Posts: 22
Location: Bangalore

PostPosted: Tue May 05, 2009 11:38 am
Reply with quote

Even I tried a similar move from CICS screen to the Table sometimes back. It went as under:
1. BMS: the attribute was set as (UNPROT,NUM).
2. Table: Datatype was decimal(7,2) not null .
3. COBOL-CICS-DB2 program:
data was accepted from the screen and directly moved to table as:

Code:
MOVE  ADJAM3I              TO    TBS-ADJ-AMT


SQL is the same as the one provided by HILLS

The Transaction works as under:

When 2 in entered - the table gets 00000.02
When 22222 in entered - the table gets 00222.22


( I would suggest rather than moving data from MAP Inputs to WS-variables and then to the TABLE, we can directly move it to the TABLE)
Back to top
View user's profile Send private message
aishwarya_20

New User


Joined: 19 Nov 2008
Posts: 57
Location: pune

PostPosted: Tue May 05, 2009 1:24 pm
Reply with quote

When you are receiving data from CICS screen then what is the defination of ADJAM3I in the map i.e. what Picture clause is there?
Back to top
View user's profile Send private message
Vishu

New User


Joined: 23 Mar 2009
Posts: 22
Location: Bangalore

PostPosted: Tue May 05, 2009 1:56 pm
Reply with quote

Quote:
When you are receiving data from CICS screen then what is the defination of ADJAM3I in the map i.e. what Picture clause is there?


Code is as under:
Code:

ADJAM3  DFHMDF POS=(10,28),ATTRB=(FSET,UNPROT,NUM),COLOR=NEUTRAL,      X
               HILIGHT=UNDERLINE,LENGTH=7
Back to top
View user's profile Send private message
aishwarya_20

New User


Joined: 19 Nov 2008
Posts: 57
Location: pune

PostPosted: Tue May 05, 2009 1:58 pm
Reply with quote

It means if you declare hot variable as x(5) then it will be as per your expectation.
Back to top
View user's profile Send private message
Vishu

New User


Joined: 23 Mar 2009
Posts: 22
Location: Bangalore

PostPosted: Tue May 05, 2009 2:19 pm
Reply with quote

Quote:
It means if you declare hot variable as x(5) then it will be as per your expectation.


Yes, we can say it is equivalent to x(7) .
( sorry to correct you but LENGTH=7 not =5) icon_smile.gif
Back to top
View user's profile Send private message
aishwarya_20

New User


Joined: 19 Nov 2008
Posts: 57
Location: pune

PostPosted: Tue May 05, 2009 2:22 pm
Reply with quote

I metioned length as 5 which is pointing to your problem. In your problem you were having DEC(5,2). So in your program you can move data to PIX X(5). It should give correct result.
Back to top
View user's profile Send private message
Vishu

New User


Joined: 23 Mar 2009
Posts: 22
Location: Bangalore

PostPosted: Tue May 05, 2009 2:35 pm
Reply with quote

Quote:
I metioned length as 5 which is pointing to your problem. In your problem you were having DEC(5,2). So in your program you can move data to PIX X(5). It should give correct result.


This will be helpfull to HILLS ( The creater of this topic).

My code is different and has DECIMAL(7,2). It is working fine.
I posted my code to show how it could be done.
Back to top
View user's profile Send private message
hills

New User


Joined: 27 Apr 2009
Posts: 8
Location: Bangalore

PostPosted: Wed May 06, 2009 11:50 am
Reply with quote

Hi all,

Thanks,

But the problem is still not solved...
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: Wed May 06, 2009 2:45 pm
Reply with quote

Quote:
But the problem is still not solved...
And you've been asked for data you haven't provided. If you're using CICS, you have a program that is being run when you enter the transaction name. The variable definitions in that language, and the data movement steps getting the values from the map and back, are absolutely critical to figure out your problem. Without them, we can't help.
Back to top
View user's profile Send private message
hills

New User


Joined: 27 Apr 2009
Posts: 8
Location: Bangalore

PostPosted: Wed May 06, 2009 3:23 pm
Reply with quote

Map Definitions will take 'X'.

now in the map, I can enter only 5 values at max.

I am giving 12345 in the map

Now In the program I am using this input value and moving directly into database:-
Code:
MOVE  LCRATEI     TO    TBS-LCALL-RATE
MOVE  LDCRATI              TO    TBS-SDCALL-RATE
MOVE  ISDRATI              TO    TBS-ICALL-RATE


and then running the SQL query as below:-
Code:
EXEC SQL
         INSERT INTO TBSPLTR (TBS_LCALL_RATE,
                                            TBS_SDCALL_RATE,
                                            TBS_ICALL_RATE)
                             VALUES  (:TBS-LCALL-RATE,
                                           :TBS-SDCALL-RATE,
                                           :TBS-ICALL-RATE)
END-EXEC.


In the database the columns are defined as DEC(5,2).

When I am checking database SPUFI, the value is shows as 345.00

Do tell me if you need more information.
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: Wed May 06, 2009 11:49 pm
Reply with quote

Hello,

What part of this
Quote:
The variable definitions in that language,
was not clear?

As you have no idea what the problem is, you need to provide the info that was requested to try to help you. You do not need to decide what people should have - simply provide all of the requested info.

After this many iterations, it would probably be best if you copy/paste and "Code" all of the requested info in one reply so that people trying to help have everything available in one place.
Back to top
View user's profile Send private message
Raghu navaikulam

Active User


Joined: 27 Sep 2008
Posts: 193
Location: chennai

PostPosted: Thu May 07, 2009 1:23 am
Reply with quote

Hi hills

To rectify this problem easily, you better define your map variable with PICIN. When using PICIN, you just specify the actual length of data
(eg. for DEC(5,2), PICIN='9(3)V99' ). Then you can move the data directly from the map variable(Host variable) to the database. Assume that you are not placing a decimal point in the map at the time of data entry. Make sure that the map is used for input only(MODE=IN).
If the MODE=INOUT, you have to code PICOUT also. PICOUT='9(3).99'. Here the length of PICIN and PICOUT will not satisfy(LENGTH=5). See the modified MACRO below.

Code:
ADJAM3  DFHMDF POS=(10,28),ATTRB=(FSET,UNPROT,NUM),COLOR=NEUTRAL,      X
               HILIGHT=UNDERLINE,LENGTH=6,                             X
               PICIN='9(4)V99,PICOUT='9(3).99'


In this case you can enter 6 digits without putting a decimal point. What ever data you are entering, that will be right justified and the last two digits will be considered as part decimal point. Assume you are entering 123456, the actual data stored in the table will be 234.56. So care should be taken at data entry time. If the map is defined for input only, then there is no PICOUT, no mismatch of length.

There are other methods also to rectify your issue.
First you try this. If not satisfied, post your requirement. Someone will help you.

Regards
Raghu
Back to top
View user's profile Send private message
hills

New User


Joined: 27 Apr 2009
Posts: 8
Location: Bangalore

PostPosted: Thu May 07, 2009 4:33 pm
Reply with quote

Hi Raghu,

Thanks, the problem is solved. I used PICIN. Data is being moved correctly from CICS screen to database.
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 Using API Gateway from CICS program CICS 0
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Calling an Open C library function in... CICS 1
No new posts How to 'Ping' a CICS region in JCL CICS 2
Search our Forums:

Back to Top