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
 
funtion in cobol like varchar in db2

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
sivatechdrive

Active User


Joined: 17 Oct 2004
Posts: 190
Location: hyderabad

PostPosted: Thu Feb 24, 2005 9:32 am    Post subject: funtion in cobol like varchar in db2
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    Post subject: varchar and cobol code
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: 190
Location: hyderabad

PostPosted: Fri Feb 25, 2005 10:54 am    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts IEW2456E error when link-editing a C ... Senthilraj JCL & VSAM 0 Fri Oct 13, 2017 3:12 pm
No new posts Assembler Macro Copybook converted to... Ziquilix PL/I & Assembler 4 Tue Sep 26, 2017 3:07 am
This topic is locked: you cannot edit posts or make replies. Extract all "IF" Statements... Adarsh Damodaran CLIST & REXX 1 Wed Sep 06, 2017 9:28 am
No new posts ALPHABETIC check in COBOL vidyaa COBOL Programming 8 Thu Aug 17, 2017 7:13 pm
No new posts XML Parse for COBOL 5.2 Bhanu Praveen COBOL Programming 1 Sat Jul 08, 2017 8:58 pm

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