C Call OpenVMS

Penney, John resolutebay at yahoo.com
Wed Sep 9 17:46:17 CDT 2009



OK, PH List:
 
This is what I've been able to ascertain, i.e. if anbody is interested and by the volume of traffic....
 
I've tried two approaches - buildexternal with a 'share' and without a share'. 
 
With both it seems that zero, zilch, rien, nada, bupkas is happening in the C code:
 
I've attached the C and the PH code sources and my buildexternals, etc.
 
This cannot be that complicated but I haven't done this sort of stuff in 10 years...
 
TIA and hoping for a reply
 
screen cts_call_c activities entry, find


temp t_prod_ok        char*02
temp t_temp_no        int*04 size 2
temp t_err_msg        char*12

temp br_id         char*08 
temp ORD_ID        int*08
temp ORD_SEQ        int*08
temp SEND_TO_HOST    char*08
temp SEND_TO_PORT    int*08
temp TMP_PRINT_C_ERR    char*08

file dummy primary
access sequential

skip to 3
title "Test 'C' Subroutine Call" at ,2 centered
skip to 5
align (1,3,10)
field t_temp_no label "Temp #"
skip 1
field t_err_msg label "Errmsg" display
cluster
;==============================

procedure edit t_temp_no
begin
let t_prod_ok = "Y"
let t_err_msg = "Passed"
display t_err_msg
info = "t_temp_no before " + ascii(t_temp_no,4) now response
info = "t_prod_ok before " + t_prod_ok now response
info = "t_err_msg before " + t_err_msg now response
do external "CEDIT" (t_prod_ok, t_err_msg, value(t_temp_no))
info = "t_temp_no after  " + ascii(t_temp_no,4) now response
info = "t_prod_ok after  " + t_prod_ok now response
info = "t_err_msg after  " + t_err_msg now response

if t_prod_ok <> "Y" 
then display t_err_msg
end

;procedure internal dsply_symbols
;begin
;run command "show symbol POS_BRANCH"
;run command "show symbol POS_ORDER"
;run command "show symbol POS_ORD_SEQ"
;run command "show symbol POS_HOST"
;run command "show symbol POS_PORT"
;run command "show symbol POS_PRINT_C_ERR"
;
;run command "WAIT 00:00:15"
;end


;PROCEDURE initialize 
;BEGIN
;let br_id         = "99"
;let ORD_ID        = 12345679
;let ORD_SEQ        = 1
;let SEND_TO_HOST    = "Y"
;let SEND_TO_PORT    = 1
;let TMP_PRINT_C_ERR    = "Z"
;;get dummy using 1 sequential opt
;;run command "WAIT 00:00:15"
;IF SETSYSTEMVAL('POS_BRANCH', BR_ID,SYMBOL)
;THEN NULL
;IF SETSYSTEMVAL('POS_ORDER', ASCII(ORD_ID),SYMBOL)
;THEN NULL
;IF SETSYSTEMVAL('POS_ORD_SEQ', ASCII(ORD_SEQ ), SYMBOL )
;THEN NULL
;IF SETSYSTEMVAL("POS_HOST",TRUNCATE(SEND_TO_HOST),SYMBOL)
;THEN NULL
;IF SETSYSTEMVAL("POS_PORT",TRUNCATE(ASCII(SEND_TO_PORT)),SYMBOL)
;THEN NULL
;IF SETSYSTEMVAL("POS_PRINT_C_ERR", TMP_PRINT_C_ERR, SYMBOL )
;THEN NULL
;
;do internal dsply_symbols
;return
;end

C Program:
 
 /*====================================================================
*
*              COPYRIGHT (C) 1989, 1998 BY
*          DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.*
* This software is furnished under a license and may be used and  copied
* only  in  accordance  with  the  terms  of  such  license and with the
* inclusion of the above copyright notice.  This software or  any  other
* copies  thereof may not be provided or otherwise made available to any
* other person.  No title to and ownership of  the  software  is  hereby
* transferred.
*
* The information in this software is subject to change  without  notice
* and  should  not  be  construed  as  a commitment by DIGITAL EQUIPMENT
* CORPORATION.
*
* DIGITAL assumes no responsibility for the use or  reliability  of  its
* software on equipment which is not supplied by DIGITAL.
*
*
*  FACILITY:
*    INSTALL 
*      
*
*  ABSTRACT:
*    This is an example of a TCP/IP client using the IPC 
*    socket interface.
*      
*
*  ENVIRONMENT:
*    TCPIP V5.0 or higher
*
*    This example is portable to Ultrix. The include
*    files are conditionally defined for both systems
*
*  BUILD INSTRUCTIONS:
*
*       To link in VAXC/VMS you must have the following
*       entries in your .opt file:
*          sys$library:TCPIp$ipc.olb/lib
*          sys$share:vaxcrtl.exe/share
*
*       For DEC C or DEC C++, compile /PREFIX=ALL and link via
*          $ link TCPIP$TCP_CLIENT_IPC
*
*    To build this example program use commands of the form,
*
*        using the DEC "C" compiler:
*
*            $ cc/prefix=all TCPIP$TCP_CLIENT_IPC.C
*            $ link TCPIP$TCP_CLIENT_IPC
*    
*        using the DEC "C++" compiler:
*    
*            $ cxx/prefix=all/define=VMS TCPIP$TCP_CLIENT_IPC.C
*            $ link TCPIP$TCP_CLIENT_IPC
*    
*        using the VAX "C" compiler:
*    
*            $  cc /vaxc TCPIP$TCP_CLIENT_IPC.C
*            $  link TCPIP$TCP_CLIENT_IPC, -
*                    SYS$LIBRARY:TCPIP$IPC/LIB, -
*                    SYS$INPUT/OPTIONS
*            SYS$SHARE:TCPIP$IPC_SHR/SHARE
*            SYS$SHARE:VAXCRTL.EXE/SHARE
*    
*  AUTHORS:
*    TCPIP Developer    
*       Copied from TCP$IP_CLIENT_IPC.C and modified by RBW
*  CREATION DATE: April 15, 2000 
*
*  MODIFICATION HISTORY:
*
*    4/26/02 - BICKELJ Changed from using one send_msg and 
*        one rcv_msg parameter to 6 send_msg and 2 rcv_msg. 
*        Along with this, added the associatated trim/concat/splits.
*        NOTE - Also changed the receive call to the socket to use a hard constant
*          rather than strlen(rcv_msg) as was in original.  Originally, the rcv_msg
*          var was passed as a parameter by Powerhouse.  Powerhouse initialized the value
*          of the string automatically (to spaces).  Now that the string is declared locally,
*          there is no value initialization - therefore strlen will not work (returns 0).  This 
*          does not apply to send_msg, since this is given a value before strlen() is called on it.
*          CCN:2002-778
*/


/*
*
*  INCLUDE FILES
*
*/

#if defined(VMS) || defined(__VMS)
#include  <stdlib.h>
#include  <unixio.h>
#include  <errno.h>
#include  <types.h>
#include  <stdio.h>
#include  <socket.h>
#include  <in.h>
#include  <netdb.h>            /* change hostent to comply with BSD 4.3*/
#include  <inet.h>
#include  <descrip>
#include  <perror>
#include  <time>
#include  <lib$routines>
#include  <tcpip$inetdef.h>         /* INET symbol definitions */
#else
#include <errno.h>
#include <sys/types.h>
#include <stdio.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <sys/uio.h>
#endif
#include <string.h>

/*
*
*   MACRO DEFINITIONS
*
*/

#ifndef vms
#define TRUE 1
#define FALSE 0
#endif

/*
* Functional Description
* Subroutine CEDIT(prod_ok, err_msg, prod_no)    
*/

cedit(prod_ok, err_msg, prod_no)    

char         prod_ok[];
     
char         *err_msg;

short int    prod_no;

/*
This subroutine simulates an error check routine (c) Cognos Inc.
if the product number is greater than 7777 it returns an error message
*/


{

if (prod_no > 7777) 

{

/* 
insert error message:
*/

strncpy(err_msg,"FAILED",13);

prod_ok[0] = 'N';

prod_ok[1] = '\0';         /* Null srting terminator */
}
}
/* end-of-program */

 
CTS_ROOT:[WORK.PENNYJ]QKDRIVER.PHEXE;2          18   9-SEP-2009 14:54:05.84
 
with buildexternal cedit cedit
 
AND 
 
LINK/EXE=CTS_ROOT:[WORK.PENNYJ]QKDRIVER.PHEXE;/MAP=XXX/FULL CTS_ROOT:[WORK.PENNYJ]BLDEXT_SUBLIST.OBJ;,PH_LOCATION:ALPHA_DRIVER_MAINLINE.OBJ,SYS$DISK:[]CEDIT,PH_LOCATION:SUBR_TABLE_PSEC.OPT/OPTPSECT_ATTR=SUBR_TABLE,PIC,USR,OVR,REL,GBL,NOSHR,NOEXE,RD,WRT,NOVEC
 
xxx.map
 
Confused in PHX...
 
TIA Again folks 
 
John M Penney
1532 Fern Street SW
Olympia, WA  98502
 
(360)789-8159


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.sowder.com/pipermail/powerh-l/attachments/20090909/8664470f/attachment.htm 


More information about the powerh-l mailing list