Receiving String Arguments from External Routines

[Note]

In order to successfully construct external call tables, you should be familiar with VMS descriptors.

External calls can receive output strings from external routines in two ways. The first method requires the external routine to allocate space for the output string; this is particularly useful when the length of the output string is unknown or is likely to vary significantly. In the second method, the external call preallocates string space before passing the descriptor to the external routine. This method is particularly convenient when calling the VMS Run-time Library routines directly.

To allocate space for output strings within the called routine:

To pass output strings using preallocated string space:

Example:

	.title zctablexample
	.library "gtm$dist:gtmzcall.mlb"
	zcinit
	
	routinecallname=lexp, linkname=lexp, outputs=1
	returnclass=status
	outputposition=1, qualifier=preallocate, -
	mechanism=descriptor, type=string, value=255
	zcallfin
	.end
	

This shows an output that is PREALLOCATEd and has a buffer size of 255 bytes. The hyphen (-) in the last position of the line, for example, at the end of the output line, acts as a line continuation in MACRO.