This section lists the changes to the example of creating a user application program. The changes are indicated by underlines.
10 /*
20 * MHP service function
30 */
40 #include <stdio.h>
50 #include <sys/types.h>
60 #include <dcmcf.h>
70 #include <dcrpc.h>
80
90 void svrA()
100 {
110 DCLONG action ;
120 DCLONG commform ;
130 DCLONG opcd ;
140 DCLONG active ;
150 char recvdata [1024] ;
160 DCLONG rdataleng ;
170 DCLONG time ;
180 DCLONG inbufleng ;
190 int rtn_cod ;
200 DCLONG cdataleng ;
210 char termnam [10] ;
220 static char execdata [32] = " SVRA EXECAP DATA" ;
230 static char senddata [32] = " SVRA REPLY DATA1" ;
240 static char resv01 [9] = "\0" ;
250 static char resv02 [9] = "\0" ;
260 static char resv03 [9] = "\0" ;
270 static char apnam [9] = "aprepB" ;
280
290 printf("***** UAP START *****\n") ;
300
310 printf("***** MCF RECEIVE *****\n") ;
320 /*
330 * MCF- RECEIVE (receive messages)
340 */
350 action = DCMCFFRST ;
360 commform = DCNOFLAGS ;
370 inbufleng = sizeof(recvdata) ;
380 rtn_cod = dc_mcf_receive(action, commform, termnam, resv01,
390 recvdata, &rdataleng, inbufleng, &time) ;
400 if(rtn_cod != DCMCFRTN_00000) {
410 /*
420 * MCF- ROLLBACK (error processing)
430 */
440 printf("dc_mcf_receive failed !! CODE = %d \n", rtn_cod) ;
450 rtn_cod = dc_mcf_rollback(DCMCFNRTN) ;
460 }
470
480 printf("***** MCF EXECAP *****\n") ;
490 /*
500 * MCF-EXECAP (start the application program)
510 */
520 action = DCMCFEMI | DCMCFJUST ;
530 commform = DCNOFLAGS ;
540 active = 0 ;
550 cdataleng = 16 ;
560 rtn_cod = dc_mcf_execap(action, commform, resv01, active,
570 apnam, comdata, cdataleng) ;
580 if(rtn_cod != DCMCFRTN_00000) {
590 /*
600 * MCF- ROLLBACK (error processing)
610 */
620 printf("dc_mcf_execap failed !! CODE = %d \n", rtn_cod) ;
630 rtn_cod = dc_mcf_rollback(DCMCFNRTN) ;
640 }
650
660 printf("***** MCF REPLY *****\n") ;
670 /*
680 * MCF-REPLY (send a response message)
690 */
700 action = DCMCFEMI ;
710 commform = DCNOFLAGS ;
720 opcd = DCNOFLAGS ;
730 cdataleng = 16 ;
740 rtn_cod = dc_mcf_reply(action, commform, resv01, resv02,
750 senddata, cdataleng, resv03, opcd) ;
760 if(rtn_cod != DCMCFRTN_00000) {
770 /*
780 * MCF- ROLLBACK (error processing)
790 */
800 printf("dc_mcf_reply failed !! CODE = %d \n", rtn_cod) ;
810 rtn_cod = dc_mcf_rollback(DCMCFNRTN) ;
820 }
830 }