Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!uflorida!umd5!umbc3!kend From: kend@umbc3.UMD.EDU (Ken Dahl) Newsgroups: comp.os.vms Subject: Re: Passing strings from Cobol to Pascal Message-ID: <1089@umbc3.UMD.EDU> Date: 18 Jul 88 22:46:11 GMT References: <3744@enea.se> Reply-To: kend@umbc3.UMD.EDU (Ken Dahl) Organization: University of Maryland, Baltimore County Lines: 21 In article <3744@enea.se> sommar@enea.se (Erland Sommarskog) writes: >The scene: I have several Cobol modules that call this same Pascal >module. Thus, all tricks should be on the Pascal side. > All Cobol modules have the same appearance, only the contents of >the strings vary beside a message code. Basically I want to write: > CALL "Pascal_routine" USING Specific_msg_code, > BY "specific text" > GIVING Ret_status >and a Pascal declaration like: > (. Global .) > FUNCTION Pascal_routine( Code : integer; > VAR Str : VARYING(.$len.) OF char) : integer; The mechanism you want to use in the COBOL Call statement is DESCRIPTOR. In the Pascal function declaration, you should add %REF before CODE since COBOL passes arguments by REFERENCE by default, and add %STRDESCR before STR since the string will be passed by descriptor. For more help, you can check the COBOL (section 6) and Pascal (section 7) reference manuals.