| IBM MAINFRAME HELP & SUPPORT FORUMS Technical Forums for IBM Mainframe Applications like COBOL, JCL, CICS, DB2, FileAid, DFSORT, Endevor, Xpediter, CoolGen, CA-7&11, AbendAid, IMS, IDMS, PL/I, MqSeries, SyncSort, Assembler, ChangeMan, Easytrieve, InterTest, REXX, CLIST etc...
|
| View previous topic :: View next topic |
| Author |
Message |
sivatechdrive
Joined: 17 Oct 2004
Posts: 168
Location: hyderabad
|
| Posted: Thu Feb 24, 2005 9:32 am Post subject: funtion in cobol like varchar in db2 |
|
|
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
Joined: 24 Feb 2005
Posts: 4
Location: pune
|
| Posted: Thu Feb 24, 2005 6:00 pm Post subject: varchar and cobol code |
|
|
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
Joined: 17 Oct 2004
Posts: 168
Location: hyderabad
|
| Posted: Fri Feb 25, 2005 10:54 am Post subject: |
|
|
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
Joined: 30 May 2003
Posts: 1508
|
| Posted: Sun Feb 27, 2005 1:49 am Post subject: |
|
|
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 |
|
| |
THIS IS AN ARCIVE FORUM IN READ ONLY MODE. IF YOU WANT TO ASK YOUR DOUBTS USE THE ACTUAL FORUM
|