MCGEE@NUACC.ACNS.NWU.EDU (Randy McGee) (05/17/88)
VERY GOOD REPLY! It seems that some people just never take the time to read the manuals. However, there are a few additional points in your reply that I thought I'd point out. > To pass a READONLY string of *ANY* type, declare the *formal* parameter in the > RTL routine declaration as a CLASS_S descriptor; > e.g. Any_String : [CLASS_S] PACKED ARRAY [Lo..Hi:INTEGER] OF CHAR ; > > To pass a READWRITE string of type PACKED ARRAY OF CHAR, use the %STDESCR > mechanism, either on the actual parameter when passed, or on the formal > parameter of the RTL routine declaration; > e.g. { formal declaration } %STDESCR Packed_String : PACKED ARRAY ..... ; > { actual parameter } LIB$GET_COMMON (%STDESCR Return_String) ; Note that the attribute [CLASS_S] and %STDESCR are identical in formal declarations for READWRITE conformant PACKED ARRAY strings. We prefer to use the [CLASS_S] attribute rather than the %STDESCR modifier. > To pass a READWRITE string of type VARYING OF CHAR, use the %DESCR mechanism, > either on the actual parameter when passed, or on the formal parameter of the > RTL routine declaration; > e.g. { formal declaration } %DESCR Varying_String : VARYING ..... ; > { actual parameter } LIB$GET_COMMON (%DESCR Return_String) ; Note that this can only be used for RTL and Utility routines, but *NOT* for system services. They can only handle fixed strings. However, you can (and we do a lot) use varying strings as follows: VAR the_time: varying [23] of char; $asctim( the_time.length, the_time.body ); WRITELN( 'The time is: ', the_time ); In this example we pass the separate parts of the varying string to the system service. We can do this since the_time.body is a fixed character string. Passing the_time.length for the return length parameter ensures that the varying string will acurately reflect the "valid" data returned. MAGOO