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

funtion in cobol like varchar in db2


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sivatechdrive

Active User


Joined: 17 Oct 2004
Posts: 191
Location: hyderabad

PostPosted: Thu Feb 24, 2005 9:32 am
Reply with quote

Hi


is there any fuction in cobol which fucntions like a varchar in db2

Suppose if i declare

01 A pic x(10).
Even if i give 'AB' as input it occupies 10 bytes,but i want to allocate only 2 bytes, is there ant function to achieve this or any logic

Thanks
Siva
Back to top
View user's profile Send private message
prasannanjaneya chowdary

New User


Joined: 24 Feb 2005
Posts: 4
Location: pune

PostPosted: Thu Feb 24, 2005 6:00 pm
Reply with quote

hai siva,

There is one procedure to get meet ur requirement.
if u want to declare a variable in cobol and which functioning show be like varchar in db2, the code should be like this


let AA is the variable in cobol,

we can declare like this

01 aa
49 aa-len pic s9(04).
49 aa-data pic 9(8).

the elementary item must be in level 49.
and size of this variable aa is 10 bytes


regards

prasanna
Back to top
View user's profile Send private message
sivatechdrive

Active User


Joined: 17 Oct 2004
Posts: 191
Location: hyderabad

PostPosted: Fri Feb 25, 2005 10:54 am
Reply with quote

hi Prasanna


i think u have given me the equivalent declaration of Db2varchar type in Cobol
But i need to save memory,even by declaring
01 aa
49 aa-len pic s9(4) comp.
49 aa-txt pic x(10).

the aa-txt occupies 10 bytes + the len occupies 2 byes so 12 bytes,but
i need to save the memory


thanks
siva
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sun Feb 27, 2005 1:49 am
Reply with quote

No Siva, there's no function like varchar.

You can use function reverse and inspect for leading spaces then do the math. That's about as good as it gets.
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Generate random number from range of ... COBOL Programming 3
Search our Forums:

Back to Top