C Call OpenVMS
Lorry Litman
LLitman at manitoba-ehealth.ca
Thu Sep 10 08:41:40 CDT 2009
Hi John, I haven't looked closely at the code below and I haven't looked
at buildexternal in eons, but, a couple quick suggestions
Does the logical qkdriver point to where your qkdriver file is?
For the command buildexternal, try specifying the library for the second
parameter and the qkdriver file in the third parameter. Make sure to
include full device and directory.
Not sure about your quick code, but, just through a designer procedure
in there with one line do external cedit or whatever the name is.
Sorry, can't help with the C code.
Hope this helps some.
Lorry
________________________________
From: powerh-l-bounces+llitman=manitoba-ehealth.ca at lists.sowder.com
[mailto:powerh-l-bounces+llitman=manitoba-ehealth.ca at lists.sowder.com]
On Behalf Of Penney, John
Sent: Wednesday, September 09, 2009 5:46 PM
To: power-l
Subject: C Call OpenVMS
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_MAINL
INE.OBJ,SYS$DISK:[]CEDIT,PH_LOCATION:SUBR_TABLE_PSEC.OPT/OPTPSECT_ATTR=S
UBR_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/20090910/63d091d3/attachment-0001.htm
-------------- next part --------------
This email and/or any documents in this transmission is intended for the
addressee(s) only and may contain legally privileged or confidential information. Any unauthorized use, disclosure, distribution, copying or dissemination is strictly prohibited. If you receive this transmission in error, please notify the sender immediately and return the original.
Ce courriel et tout document dans cette transmission est destin? ? la personne ou aux personnes ? qui il est adress?. Il peut contenir des informations privil?gi?es ou confidentielles. Toute utilisation, divulgation, distribution, copie, ou diffusion non autoris?e est strictement d?fendue. Si vous n'?tes pas le destinataire de ce message, veuillez en informer l'exp?diteur imm?diatement et lui remettre l'original.
More information about the powerh-l
mailing list