[HECnet] Slightly OT - How to concatenate multi line strings in DEC COBOL

Sampsa Laine sampsa at mac.com
Wed Sep 12 19:21:53 PDT 2012


Ah,

That for    example  calling C from COBOL is for OSF/1 only. I wonder how one does this on VMS..

Sampsa


On 12 Sep 2012, at 21:10, Michael Young wrote:
found this at odl.sysworks.biz/disk$axpdocdec971/progtool/d37aaa48.p341.bkb#2110 :

Example 12-8: C Include File " cobfunc "
    void cobcancel ( /* CANCEL the named COBOL routine */
                char *name
                );
    int cobcall ( /* Call a COBOL program from a C routine */
                char *name, /* READ: name of the program */
                int argc, /* READ: how many arguments */
                char **argv /* READ: array of pointers to the arguments */
                );
    int cobfunc ( /* Call a COBOL program from a C routine, then CANCEL it */
                char *name, /* name of the program */
                int argc, /* how many arguments */
                char **argv /* array of pointers to the arguments */
                );
    #ifdef __osf__
    void cob_init ( /* init the RTL */
                int argc, /* argument count */
                char **argv, /* arguments */
                char **envp /* environment variable pointers */
                );
    #endif


--Mike


On Sep 12, 2012, at 1:54 PM, Sampsa Laine <sampsa at mac.com> wrote:
Does anybody happen to have a nice sample bit of code on how to call a C function from DEC COBOL?

The documentation gave me this code:

/* crtn - c function to test use of argc and argv in c routines
 *   called from HP COBOL  */

#include "cobfunc.h"
#include <stdio.h>

extern int _ _Argc;
extern char **_ _Argv[];
#define argc _ _Argc
#define argv (*_ _Argv)

void crtn()
{
 int i;

 i = 0;
 for (i = 0; i < argc; i++) {
  printf("argv[%d] = %s\n", i, argv[i]);
 }
}

But I can't find cobfunc.h anywhere   

Sampsa


On 12 Sep 2012, at 20:18, Sampsa Laine wrote:
Well this whole COBOL thing is verging on the humour value anyway, I think I might leave that til later :)

Sampsa

On 12 Sep 2012, at 20:13, Jordi Guillaumes i Pons wrote:

IIRC there was no screen section support in VAX COBOL. 

Perhaps this can be a good excuse to learn the SMG$ RTL routines...


Jordi Guillaumes i Pons
Barcelona - Catalunya - Europa

El 12/09/2012, a les 17:10, Sampsa Laine <sampsa at mac.com> va escriure:
Tried to compile my little program on GORVAX but it has problems with the SCREEN SECTION that works on the AXP version..

I'm thinking I must have an old compiler or something. Anyone know what the latest is? 

Anyone have a kit?

Sampsa




Michael Young
young at ecn.purdue.edu



More information about the Hecnet-list mailing list