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

Host variables in COBOL


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

Active User


Joined: 29 Oct 2010
Posts: 205
Location: Toronto, ON, Canada

PostPosted: Wed Jun 27, 2012 8:06 pm
Reply with quote

If I have a variable structure
Code:
01 A.
05 B.
10 C.
15 D PIC X(10).

If D is not unique within the program I have to do
Code:
MOVE 'TEXT' TO D OF A


If I want to use D as a variable in an SQL fetch how do I code this?
Code:
FETCH my-cursor INTO :D OF A

I looked through the db2 manuals but couldn't find this.
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Wed Jun 27, 2012 8:10 pm
Reply with quote

May be Try ??

Code:
FETCH my-cursor INTO :A.D
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Wed Jun 27, 2012 8:23 pm
Reply with quote

Pandora-Box.. you were close..
It should be C.D

Jerry, please let us know if this satisfies your requirement.
I could find this link from IBM..
Back to top
View user's profile Send private message
Naish

New User


Joined: 07 Dec 2006
Posts: 82
Location: UK

PostPosted: Wed Jun 27, 2012 8:27 pm
Reply with quote

I tried
Code:
:A.D
Code:
:B.D
Code:
:C.D
. All of them worked... icon_smile.gif
Back to top
View user's profile Send private message
jerryte

Active User


Joined: 29 Oct 2010
Posts: 205
Location: Toronto, ON, Canada

PostPosted: Wed Jun 27, 2012 8:32 pm
Reply with quote

Thanks all. Just curious - is it possible to do:
Code:
:A.B.C.D
?
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Wed Jun 27, 2012 8:37 pm
Reply with quote

Quote:
Just curious - is it possible to do:

Code:
:A.B.C.D


Why dont you try that yourself icon_cool.gif
Back to top
View user's profile Send private message
Naish

New User


Joined: 07 Dec 2006
Posts: 82
Location: UK

PostPosted: Wed Jun 27, 2012 8:38 pm
Reply with quote

Only if you had tried you would have got the pleasure of finding/trying something new... (pun intended)

it works... icon_cool.gif
Back to top
View user's profile Send private message
View previous topic : : View next topic  
Post new topic   Reply to topic All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts IBM IMU Utility for Easytrieve Code t... IBM Tools 0
No new posts Big Five Personality Test in COBOL - ... COBOL Programming 0
No new posts I wrote a Hallmark Movie Plot Generat... COBOL Programming 0
No new posts COBOL Text Adventure Engine for TK4- ... COBOL Programming 0
No new posts Cobcalc: An Algebraic Expression Eval... COBOL Programming 10
Search our Forums:


Back to Top