support: Customer Portal
Focused on delivering choice, investment protection and flexibility to organizations with valuable COBOL assets
 

Veryant Knowledge Base
Home > All Categories > isCOBOL Compiler > Is there any disadvantage to using -cp compiler option for full pointer support?
Question Title Is there any disadvantage to using -cp compiler option for full pointer support?
By default (i.e. without -cp), the isCOBOL compiler uses Java memory for all data items. The Java Virtual Machine safeguards programs that use purely Java memory and that do not call native functions. These programs cannot cause memory protection faults, bus errors, segmentation violations, stack corruption, illegal instructions, and other memory related problems.

-cp is implemented using native memory. It enables the following functionality:

  • Pointer arithmetic
  • All uses of "ADDRESS OF". For example:
    • SET ptr to ADDRESS OF data-item
    • SET ADDRESS OF lk-item TO ptr
    • SET ADDRESS OF lk-item TO ADDRESS OF data-item
    • IF ADDRESS OF data-item NOT = ZERO
  • A COBOL program to receive and use memory addresses (pointers) from C language and other native functions that have allocated native memory.
  • A C language or other native function to save passed addresses and use them outside of the context of the CALL statement (such as is done by some 3rd party software such as Pro*COBOL)
Veryant recommends that you use the -cp compiler option only if you require one or more of the above capabilities.

Note: If you need to compile with -cp and your program uses the figurative constant NULL then add the following compiler option in order to treat NULL as ZERO since NULL is reserved for use with objects (object-oriented programming):

-rm=zero,null

Note: If your program uses pointers only within COBOL and between COBOL programs and does not use pointer arithmetic, then compile with the -ca compiler option instead of -cp. The -ca option has the following effects:

  • Allows the use of the figurative constant NULL
  • Treats
    USAGE POINTER
    as
    USAGE HANDLE
  • Treats
    SET ADDRESS OF lk-item TO ptr
    as
    SET HANDLE OF lk-item TO ptr
  • Treats
    SET ADDRESS OF lk-item TO ADDRESS OF data-item
    as
    SET HANDLE OF lk-item TO HANDLE OF data-item
  • Does not allow the following syntax:
    SET ptr TO ADDRESS OF data-item
See also Does SET ADDRESS OF X TO Y work?
Authored by: Veryant Support This question has been viewed 5433 times so far.
Click Here to View all the questions in isCOBOL Compiler category.
File Attachments File Attachments
There are no attachment file(s) related to this question.
How helpful was this article to you?
User Comments User Comments Add Comment
There are no user comments for this question. Be the first to post a comment. Click Here
Related Questions Related Questions
  1. Does isCOBOL support traditional Printer Reporting?
  2. Can you provide an example ant build script (e.g. build.xml)?
  3. Having specific needs to compile a program with different compiler options than the rest of the programs in a project; how can you accomplish this task either inside the IDE or from the command line?
Article Information Additional Information
Article Number: 129
Created: 2010-05-28 11:14 AM
Rating: 2 Stars
 
Article Options Article Options
Print Question Print this Question
Email Question Email Question to Friend
Export to Adobe PDF Export to PDF File
Export to MS Word Export to MS Word
Bookmark Article
Subscribe to Article Subscribe to Article
 
Search Knowledge Base Search Knowledge Base



 
 

© Veryant - All Rights Reserved
Veryant and isCOBOL are trademarks or registered marks of Veryant in the United States and other countries. All other marks are the property of their respective owners.