View previous topic :: View next topic
|
Author |
Message |
sivatechdrive
Active User
Joined: 17 Oct 2004 Posts: 191 Location: hyderabad
|
|
|
|
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 |
|
|
prasannanjaneya chowdary
New User
Joined: 24 Feb 2005 Posts: 4 Location: pune
|
|
|
|
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 |
|
|
sivatechdrive
Active User
Joined: 17 Oct 2004 Posts: 191 Location: hyderabad
|
|
|
|
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 |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
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 |
|
|
|