Company InformationOur COBOL SolutionsCOBOL Services and TrainingSupport for our CustomersAcucorp and COBOL EventsAcucorp's Partners


















< previous      next > Print this page  

Calling 'C' Routines

Programmers who need to call 'C' routines (either directly or in a DLL) soon realise that COBOL's view of an alphanumeric string differs to that of 'C'. 'C' will expect to see a 'null' character (hex '00') at the end of the string, that's how it knows where the end is! Fortunately there's an easy way for us to do this:

INSPECT MY-STRING REPLACING TRAILING SPACES BY LOW-VALUES.

Provided there's at least one trailing space you're all done. If you are concerned that there may not be a trailing space then you should also declare the item as:

01 MY-STRING.
  03 FILLER	PIC X(25).
  03 FILLER	PIC X VALUE X'00'.

Now you're absolutely sure that there will be a trailing null in all cases.

####

Acucorp, extend and ACUCOBOL are trademarks or registered trademarks of Acucorp, Inc. All rights reserved. All other trademarks are the property of their respective owners.

 

 

Contact | Site Map | | Legal | Trademarks | Privacy | Print this page
Acucorp, Inc., 9920 Pacific Heights Blvd., San Diego, CA 92121, +1 858.795.1900
© 1999-2008, Acucorp, Inc. All rights reserved.


Get the most recent Code Updates
Download an Evaluation of ACUCOBOL- GT
View recorded Webinars and demos
Download the latest version of Acucorp News
Find out about the latest Training Opportunities
Language