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

Problem working with numeric data.


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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
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
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
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts Store the data for fixed length COBOL Programming 1
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts SCOPE PENDING option -check data DB2 2
Search our Forums:

Back to Top