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

How to use pointers in cobol


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

New User


Joined: 18 Aug 2006
Posts: 45

PostPosted: Mon Nov 27, 2006 12:30 pm
Reply with quote

Hi all,

I just want an example where pointer usage is being shown in a program.
I didnt find any example which will help me how to use pointers in cobol.
Help me out.



regards
Akshatha
Back to top
View user's profile Send private message
rajesh_mbt

New User


Joined: 27 Mar 2006
Posts: 97
Location: India

PostPosted: Mon Nov 27, 2006 2:50 pm
Reply with quote

Hi Akshatha

A COBOL pointer is like a void pointer in C: it can point to any kind of object. Pointers are mainly useful for stitching together various data objects to form a data structure. Typically, data structures are built from dynamically allocated memory.

Declare a pointer as an elementary data item bearing the USAGE IS POINTER clause, with no PICTURE. E.g:
05 EXAMPLE-P USAGE IS POINTER.

EXAMPLE-P is a four-byte field which can store the address of any data item. Unless you're interfacing COBOL to Assembler or something, you really don't care what the pointer looks like internally.
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