Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
How to convert 2 bytes into single byte in Cobol db2 program

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: How to convert 2 bytes into single byte in Cobol db2 program
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: 2247
Location: Hampshire, UK

PostPosted: Fri May 25, 2018 5:43 pm    Post subject: Reply to: How to convert 2 bytes into single byte in Cobol db2 program
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    Post subject:
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 Member


Joined: 14 Mar 2007
Posts: 10632
Location: italy

PostPosted: Fri May 25, 2018 6:07 pm    Post subject: Reply to: How to convert 2 bytes into single byte in Cobol db2 program
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    Post subject:
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: 1330
Location: Israel

PostPosted: Mon May 28, 2018 9:22 pm    Post subject:
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: 1330
Location: Israel

PostPosted: Mon May 28, 2018 9:28 pm    Post subject: Re: How to convert 2 bytes into single byte in Cobol db2 program
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Sort to construct single record from ... Deepti_R SYNCSORT 3 Wed Nov 13, 2019 12:14 am
No new posts Convert mainframe data to .csv format... karan_reddy DFSORT/ICETOOL 10 Sat Nov 02, 2019 2:09 am
No new posts COBOL -DB2 SQL code to have GROUP BY ... vinu78 DB2 21 Wed Oct 23, 2019 7:00 pm
No new posts Parsing single liner XML into readabl... rohanthengal COBOL Programming 1 Fri Oct 18, 2019 8:41 pm
No new posts Running a REXX exec program using ZOSMF Sakthi344 CLIST & REXX 3 Tue Oct 15, 2019 3:13 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us