/*头文件 */
qcaph.h
#include
#include
struct Errmsg
{
int QUSBPRV ;
int ERRCDE ;
char ERRMSGID??(7??) ;
char QUSERVED??(1??) ;
char QUSED01??(101??);
}errmsg;
struct Ctlbck
{
int CMDTYP;
char DBCSH ;
char PAMAC ;
char CMDSSY;
char MSEGKEY??(4??) ;
char RCVD??(9??) ;
}ctlbck;
#pragma map(QCAPCMD,"QCAPCMD")
void QCAPCMD(char *,int ,struct Ctlbck *,int ,char *,char ,
int ,int ,struct Errmsg *);
#pragma linkage(QCAPCMD,OS)
#pragma map(QCMDEXC,"QCMDEXC")
void QCMDEXC(char *,_Decimal(15,5));
#pragma linkage(QCMDEXC,OS)
#pragma map(QCMDCHK,"QCMDCHK")
void QCMDCHK(char *,_Decimal(15,5));
#pragma linkage(QCMDCHK,OS)
/*可执行程序 */
#include
#include
#include “qcaph.h"
/*创建临时member文件*/
int crt_tmpf_mbr(char Qcmd??(300??) )
{
int QLEN=200;
int CTLLEN =20 ;
int CHGLEN =0;
int RTULEN =0;
_Decimal(15,5) qlen;
char CTLFMT??(8??);
char CHGCMD;
/* CRTPF FILE(QTEMP/DD) RCDLEN(2048) MAXMBRS(*NOMAX) SIZE(*NOMAX) SHARE(*YES) +
ADDPFM FILE(QTEMP/DD) MBR(DDD) */
/*创建file or member
QCMDCHK(qcmd,qlen); +
QCMDEXC(qcmd,qlen); */
memset(ctlbck.MSEGKEY,0,4);
memset(ctlbck.RCVD,0,9);
/* memset(CTLFMT,"CPOP0100",8);*/
strcpy(CTLFMT,"CPOP0100");
CHGCMD=' ';
errmsg.QUSBPRV =117;
ctlbck.CMDTYP =0;
ctlbck.DBCSH='0';
/*qlen = strlen(Qcmd); */
memset(&(ctlbck.DBCSH),'0',1);
memset(&(ctlbck.PAMAC),'0',1);
memset(&(ctlbck.CMDSSY),'0',1);
QCAPCMD(Qcmd,QLEN,&ctlbck,CTLLEN,CTLFMT,CHGCMD,CHGLEN,RTULEN,&errmsg);
if((memcmp(errmsg.ERRMSGID," ",8))==0)
return 0;
else
return 1;
}
/*简单测试程序 */
void main(char **arg ,int argc)
{
int flg;
flg=crt_tmpf_mbr( arg??(1??) );
}
说明:
在rpgle中9 0B的数据类型在C中使用int类型,而10 0 i的数据类型在C中也使用int类型
5 2p的数据类型在C中使用_decimal(5,2)不过这里需要添加头文件
阅读(1395) | 评论(0) | 转发(0) |