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

How to convert 2 bytes into single byte in Cobol db2 program


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

Active User


Joined: 15 Dec 2005
Posts: 264

PostPosted: Fri May 25, 2018 1:41 pm
Reply with quote

Hi All

I try to code the below sql

Code:

Exec SQL

Select char(x:hv1) into :hv2 from sysibm.sysdummy1

End-exec.

01 hv1   x(02)  value '28'.
01 hv2   x(01).


But I am getting sqlcode -440 . If I run the same query in SPUFI . I am getting the required result. How to resolve this ?
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Fri May 25, 2018 5:43 pm
Reply with quote

Perhaps the DB2 that you run your SPUFI against is not the same as the one you run your 'other' query against and the two setups are not identical?
Back to top
View user's profile Send private message
pkmurali
Warnings : 1

Active User


Joined: 15 Dec 2005
Posts: 264

PostPosted: Fri May 25, 2018 6:01 pm
Reply with quote

The difference is X'28' used in spufi,where as in program it is host variable.
Back to top
View user's profile Send private message
enrico-sorichetti

Senior Moderator


Joined: 14 Mar 2007
Posts: 10727
Location: italy

PostPosted: Fri May 25, 2018 6:07 pm
Reply with quote

from the messages manual

Quote:
-440 NO AUTHORIZED routine-type BY THE NAME routine-name HAVING COMPATIBLE ARGUMENTS WAS FOUND


meditating on the routine-type and routine-name should give You a hint on how to proceed
Back to top
View user's profile Send private message
pkmurali
Warnings : 1

Active User


Joined: 15 Dec 2005
Posts: 264

PostPosted: Sat May 26, 2018 10:55 am
Reply with quote

Apologies it is not -440 it is -420. Is there any issue in my host variable declaration? BX'28' is 1 byte. But I declared 2 bytes. Is it possible in Cobol to convert 2 bytes to 1 byte. In SPUFI SQL I have used X'28'. Please correct me if I am wrong.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1348
Location: Israel

PostPosted: Mon May 28, 2018 9:22 pm
Reply with quote

pkmurali wrote:
If I run the same query in SPUFI . I am getting the required result.

pkmurali wrote:
The difference is X'28' used in spufi,where as in program it is host variable.

If there is a difference, then IT IS NOT THE SAME !!!!! icon_evil.gif sterb050.gif
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1348
Location: Israel

PostPosted: Mon May 28, 2018 9:28 pm
Reply with quote

pkmurali wrote:
Code:

Select char(x:hv1) into :hv2 from sysibm.sysdummy1

01 hv1   x(02)  value '28'.
01 hv2   x(01).

Because hv1 has value '28', then char(x:hv1) is equivalent to char(x'28')
Is that really what you think ???
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 linking an ALC program to a Relationa... PL/I & Assembler 1
No new posts How to convert RESP code 12 to text? CICS 9
This topic is locked: you cannot edit posts or make replies. Writng matched records into output fi... DFSORT/ICETOOL 11
This topic is locked: you cannot edit posts or make replies. Passing a field name to COBOL program COBOL Programming 10
No new posts COBOL Performance Tuning COBOL Programming 6
Search our Forums:

Back to Top