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
 

 

Problem working with numeric data.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
arvind.m

Active User


Joined: 28 Aug 2008
Posts: 205
Location: Hyderabad

PostPosted: Thu Dec 17, 2009 6:53 pm    Post subject: Problem working with numeric data.
Reply with quote

Hi all,

i am currently working with a COBOL-DB2 program and i am getting the SQLCODE -310. I know why i was getting -310 but the reason for invalid value is now know. Below is what i was doing.

I FTP a csv(comma delimited file) file int the mainframe and it looks like below

Code:

1,1,1,5881,42250,0,1,ITEM NOT FOUND ON DATABASE   


In my cobol program i used the UNSTRING to get the above values delimited by comma.

Code:

WS-1    PIC 9(07). 
WS-2    PIC 9(09). 
WS-3    PIC 9(05). 
WS-4    PIC 9(09). 
WS-5    PIC 9(13). 
WS-6    PIC 9(04). 
WS-7    PIC 9(09). 
WS-8    PIC X(30). 


UNSTRING WS-IN
DELIMITED BY ","
INTO ......



Then the above file i am moving into the host variables

Code:

DB2WF-1      PIC S9(7)V USAGE COMP-3. 
DB2WF-2      PIC S9(9) USAGE COMP.     
DB2WF-3      PIC S9(5)V USAGE COMP-3. 
DB2WF-4      PIC S9(9) USAGE COMP.     
DB2WF-5      PIC S9(13)V USAGE COMP-3.
DB2WF-6      PIC S9(4) USAGE COMP.     
DB2WF-7      PIC S9(9) USAGE COMP.     
DB2WF-8            PIC X(30).               


when i moved the first varibales into the host variables (in same order)...the moved in the host variables are different.


LIKE




like..
Code:


WS-1      9(7) DISP        0000001                 
WS-2       9(9) DISP        000000001               
WS-3       9(5) DISP        00001                   
WS-4      9(9) DISP        000005881               
WS-5      9(13) DISP       0000000042250           
WS-6      9999 DISP        0000                   
WS-7      9(9) DISP        000000001               
WS-8      X(30) DISP       'ITEM NOT FOUND ON DATABASE    '


but when i moved the above variables into the host variabels (corresponding) it contained

DB2WF-1  S9(7) CMP3       0000                   
DB2WF-2    S9(9) COMP       -0252644880             
DB2WF-3    S9(5) CMP3       000                     
DB2WF-4   S9(9) COMP       -0235867920             
DB2WF-5   S9(13) CMP3      0000042                 
DB2WF-6   S9999 COMP       -03339                 
                   
DB2WF-7  S9(9) COMP       -0252645136             
             
DB2WF-ITEM-DESC  X(30) DISP       'M NOT FOUND ON DATABASE


because of this i am getting -310. but why this is happening is a question. Please help with issue.


thanks,
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


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

PostPosted: Thu Dec 17, 2009 7:07 pm    Post subject:
Reply with quote

What are your two structures and what does the MOVE CORRESPONDING statement look like?

you have not provided anything in the way of reference names that would qualify for a move corresponding statement.
Back to top
View user's profile Send private message
arvind.m

Active User


Joined: 28 Aug 2008
Posts: 205
Location: Hyderabad

PostPosted: Thu Dec 17, 2009 7:21 pm    Post subject:
Reply with quote

it is just

Code:

MOVE ws-1   to  db2wf-1
.
.
.
.

Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Thu Dec 17, 2009 8:27 pm    Post subject:
Reply with quote

Arvind,

you program is doing something.

if the ws- variables contained the values you displayed
and
if you moved them as indicated, you would not have the results that you have displayed.

you have neglected to cut&paste the structure definitions, with level numbers.
there could be something with the structure definitions that is causing the problem, but we can not see or know.

have you run the program thru a debugger and displayed the source fields prior to the move and the destination after the move?
Back to top
View user's profile Send private message
arvind.m

Active User


Joined: 28 Aug 2008
Posts: 205
Location: Hyderabad

PostPosted: Thu Dec 17, 2009 8:35 pm    Post subject:
Reply with quote

Hi Dick,
i found out the problem. it was my mistake in the program. Thank you for your time.

Thanks,
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Thu Dec 17, 2009 9:16 pm    Post subject:
Reply with quote

Arvind,
glad you were able to solve it.

til next time
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Data replication from multiple Db2 ta... kishpra DB2 5 Mon Mar 27, 2017 9:58 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Append data from two files into a sin... Praveen04 DFSORT/ICETOOL 5 Thu Mar 16, 2017 7:29 pm
No new posts Problem reading GTF trace output danik56 ABENDS & Debugging 7 Thu Mar 16, 2017 1:02 pm
No new posts SPUFI -- Joining 3 tables – data in... Sysaron DB2 2 Wed Mar 08, 2017 4:18 am


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