Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
To display comp-3 variable

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> HomeWorks & Requests
View previous topic :: :: View next topic  
Author Message
raje_17285

New User


Joined: 05 Mar 2008
Posts: 3
Location: chennai

PostPosted: Wed Mar 05, 2008 4:23 pm    Post subject: To display comp-3 variable
Reply with quote

I have a CHAR field in a DB2 TABLE. This field has both characters and comp-3 field in it. Need a query that can display comp-3 values in normal display format.

ex: field value: "asfsaf xxxxx sassfafs"
where xxxxx is comp-3 number field

i need this xxxxx to be displayed in normal format.
Back to top
View user's profile Send private message

Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Wed Mar 05, 2008 6:20 pm    Post subject: Re: DB2 Display comp-3 variable
Reply with quote

raje_17285 wrote:
I have a CHAR field in a DB2 TABLE. This field has both characters and comp-3 field in it. Need a query that can display comp-3 values in normal display format.

ex: field value: "asfsaf xxxxx sassfafs"
where xxxxx is comp-3 number field

i need this xxxxx to be displayed in normal format.


If I took the time I might be able to figure out how to do it but it is such a stupid misuse of CHAR field that I am not going to even try. Trying reading in the sql manual about CAST.
Back to top
View user's profile Send private message
Phrzby Phil

Active Member


Joined: 31 Oct 2006
Posts: 967
Location: Richmond, Virginia

PostPosted: Wed Mar 05, 2008 7:16 pm    Post subject:
Reply with quote

Your post is confusing, meaning that you seeem to be confusing terms.

In your words, what makes xxxxx a comp-3 (a COBOL term) instead of just numeric (an English word)?

comp-3 is a COBOL term for a specific way (packed dec) to internally store numerics. The corresponding DB format is DEC, but that would be a column attribute, not just part of a char col.

I can store COBOL numerics, e.g., also as comp or display. Is there something in xxxxx that dictates comp-3?
Back to top
View user's profile Send private message
raje_17285

New User


Joined: 05 Mar 2008
Posts: 3
Location: chennai

PostPosted: Thu Mar 06, 2008 9:54 am    Post subject:
Reply with quote

Here goes the declaration of columns in two tables.

TABLE A

01 dclgen-tablea
05 filed1 PIC X(2).
05 filed2 PIC X(2).
05 filed3 PIC S9(13)V9(2) USAGE COMP-3.
05 filed4 PIC S9(13)V9(2) USAGE COMP-3.

TABLE B

01 dclgen-tableb
05 fieldx PIC X(20)


in program i move dclgen-tablea to fieldx and store the value in the TABLEB.

Noe i need to use this fieldx and get field3 and field4 values in display format.

Hope i am more clear now.

Thanks for your time.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Thu Mar 06, 2008 3:14 pm    Post subject:
Reply with quote

raje_17285 wrote:
in program i move dclgen-tablea to fieldx and store the value in the TABLEB.
Move dclgen-tablea to dclgen-tableb.
Quote:
Noe i need to use this fieldx and get field3 and field4 values in display format.
Move dclgen-tableb to dclgen-tablea.
Move field3 to field3-display.
Move field4 to field4-display.

I am confused why I'm even answering such a simplisticly dumb question.....
Back to top
View user's profile Send private message
raje_17285

New User


Joined: 05 Mar 2008
Posts: 3
Location: chennai

PostPosted: Thu Mar 06, 2008 4:04 pm    Post subject:
Reply with quote

Thanks for the answer.....
I was not clear with my question.

Actually i need to get the
field3 and field4 from fieldx in the SQL QUERY itself.

ex:

select *
from
tableb
where
substr(fieldx,5,8) > 0
substr(fieldx,13,8) > 0

Here the substr(fieldx,5,8) is having the fielda (packed) in CHAR
Which can not be compared with numeric 0.

What i need is now to convert the substr(fieldx,5,8) to numeric and compare it with 0.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10375
Location: italy

PostPosted: Thu Mar 06, 2008 4:10 pm    Post subject: Reply to: To display comp-3 variable
Reply with quote

Did You have a doctor prescription for such a setup,
what is the business reason to have such an illogic thing,
if a field/column is a packed/binary number there is absolutely no reason
to have it embedded in an alphanumeric field/column
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Thu Mar 06, 2008 6:41 pm    Post subject:
Reply with quote

Then try substr(fieldx,5,8) > X'000000000000000C'
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 -> HomeWorks & Requests All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Moving a COMP-3 Variable to a Numeric... ajayachander COBOL Programming 2 Thu Dec 14, 2017 5:46 pm
No new posts CONDITIONAL USING COMP-2 WITH PROBLEMS. JOSUEGENTIL COBOL Programming 7 Wed Nov 08, 2017 11:13 pm
No new posts how can i move s9(9) to s9(9) usage comp HARENDRA CHOUDHARY COBOL Programming 3 Mon Nov 06, 2017 12:10 am
No new posts Move from Comp3 variable to Edited Va... Revathy.nair0485 COBOL Programming 7 Fri Nov 03, 2017 3:30 pm
This topic is locked: you cannot edit posts or make replies. Can a alphanumeric data be moved to a... nico_neoz COBOL Programming 10 Mon Oct 30, 2017 8:28 am

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