Dynamic sql with cobol(-313 error)



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Dynamic sql with cobol(-313 error)

Postby ballaravi » Fri Aug 13, 2010 2:51 pm

hi, i am getting -313 error when doing dynamic sql through cobol,
i am putting screen shot,just check that and jcl code.
You do not have the required permissions to view the files attached to this post.
ballaravi
 
Posts: 18
Joined: Wed Jul 14, 2010 6:19 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Dynamic sql with cobol(-313 error)

Postby NicC » Fri Aug 13, 2010 2:58 pm

Why have you quoted the second ? ?
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: Dynamic sql with cobol(-313 error)

Postby ballaravi » Fri Aug 13, 2010 3:20 pm

second one is char type,thats why i quated
ballaravi
 
Posts: 18
Joined: Wed Jul 14, 2010 6:19 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Dynamic sql with cobol(-313 error)

Postby NicC » Fri Aug 13, 2010 3:48 pm

Did you read the manual? It says to use ? for each variable it makes no mention of quoting. It does mention using CAST if you want to bind a type to a particular ?
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: Dynamic sql with cobol(-313 error)

Postby ballaravi » Fri Aug 13, 2010 4:10 pm

ok, tomo i will check in my lab and give reply to u
ballaravi
 
Posts: 18
Joined: Wed Jul 14, 2010 6:19 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Dynamic sql with cobol(-313 error)

Postby dick scherrer » Sat Aug 14, 2010 12:10 am

Hello,

When posting information from a terminal, you should use copy/paste and the "Code" tag. "Screenshots" only waste space for no additional value.

Thanks,

d
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Dynamic sql with cobol(-313 error)

Postby ballaravi » Sat Aug 14, 2010 6:15 pm

hi,
The problem is sloved after removing the quote, it executed successfully.

but other problem came when modified code.

BEFORE:(CHECK THE SCREEN SHOT)
000023 MOVE 3 TO TESTNO.
000024 MOVE "TEST3" TO TESTNAME.


AFTER CODE CHANGED:
000023 ACCEPT TESTNO.
000024 ACCEPT TESTNAME.


JCL:
//SYSIN DD *
4
TEST4
/*


THE ERROR IS:
AT "ACCEPT TESTNO" -- IDENTIFIER TESTNO(BINARY INTEGER) WAS GIVEN IN ACCEPT.
THE STATEMENT IS DISCARDED.

HOW TO SLOVE THIS ?
ballaravi
 
Posts: 18
Joined: Wed Jul 14, 2010 6:19 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Dynamic sql with cobol(-313 error)

Postby NicC » Sat Aug 14, 2010 7:31 pm

Accept it into a compatible format, 'PIC 9'?, and move it to TESTNO. Or change your input to Binary Integer
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: Dynamic sql with cobol(-313 error)

Postby dick scherrer » Sat Aug 14, 2010 11:54 pm

Hello,

ACCEPT is not usually permitted in programs that are to be promoted to Production. Multiple accepts is an even bigger no-no. A file should be defined and read to get these values into the code.

When bringing in data from "outside", PIC X(n) fields should be used and after the data has been validated, the values moved to the desired internal formats. The mainframe is rather picky about having valid numbers in fields that are to be used in numeric instructions (including move).

Or change your input to Binary Integer
You probably do not want to define the SYSIN data in binary. . . Simply do as suggested and move the character data to the binary field after the character value is validated.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Dynamic sql with cobol(-313 error)

Postby ballaravi » Sun Aug 15, 2010 2:59 pm

who to change INPUT to BINARY INTEGER
(i.e for 4 to 0100) like this or any other way.
ballaravi
 
Posts: 18
Joined: Wed Jul 14, 2010 6:19 pm
Has thanked: 0 time
Been thanked: 0 time

Next

Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post