Cover V04, I05
Article
Figure 1
Figure 2
Figure 3
Listing 1
Listing 2
Listing 3
Listing 4
Sidebar 1

sep95.tar


Listing 4: Main code for the PC/UNIX/IBM app

Main Logic:
...
1.  CheckHostSessA();
2.  ConnHostSessA();
3.  WaitForMsg ("LOGO");
4.  ReplyWithMsg ("CICS@E");
5.  WaitForMsg ("Welcome");
6.  ReplyWithMsg ("@E");
7.  WaitForMsg ("Userid:");
8.  ReplyWithMsg ("USER@E");
9.  WaitForMsg ("Password:");
10. ReplyWithMsg ("PASS@E");
11. WaitForMsg ("Logged In");
12. ReplyWithMsg ("@C");
13. ReplyWithMsg ("SCOUNX@E");

14. while (RdChars == 0) {
15.   ch = wgetch(stdscr);
16.   RdChars = read(ImbsPort, &Imbs, sizeof(Imbs));
17.   ReplyWithMsg(Buf);       }
18.   DiscHostSessA();

Functions:
19.  CheckHostSessA()
20.  {
21.     HFunction = HA_QUERY_SESSIONS;        /* defined in hapi_c.h */
22.     HLength  = 144;
23.     HRetCode = 0;
24.     HDataString[0] = 'A';
25.     hllapi(&HFunction, HDataString, &HLength, &HRetCode);
26.  }
27.  ConnHostSessA()
28.  {
29.   HFunction = HA_CONNECT_PS;              /* defined in hapi_c.h */
30.   HLength  = 1;
31.   HRetCode = 0;
32.   HDataString[0] = `A';
33.   hllapi(&HFunction, HDataString, &HLength, &HRetCode);
34.   }
35.  WaitForMsg(char *message)
36.  {
37.     HFunction = HA_COPY_PS;               /* defined in hapi_c.h */
38.     HLength  = 0;
39.     HRetCode = 0;
40.     hllapi(&HFunction, HDataString, &HLength, &HRetCode);

41.     HFunction = HA_SEARCH_PS;             /* defined in hapi_c.h */
42.     HLength  = strlen(str);
43.     HRetCode = 1;
44.     hllapi(&HFunction, message, &HLength,  &HRetCode);
45.   }

46.  ReplyWithMsg(char *message)
47.  {
48.     HFunction = HA_SENDKEY;               /* defined in hapi_c.h */
49.     HLength = strlen(message);
50.     HRetCode = 0;
51.     hllapi(&HFunction, message, &HLength, &HRetCode);

52.     HFunction = HA_WAIT;                  /* defined in hapi_c.h */
53.     HLength = 0;
54.     HRetCode = 0;
55.     hllapi(&HFunction, HDataString, &HLength, &HRetCode);
56.  }
57.  DiscHostSess()
58.  {
59.  HDataString[0] = "A";
60.  HFunction = HA_DISCONNECT_PS;
61.  HLength = 0;
62.  HRetCode = 0;
63.  hllapi(&HFunction, HDataString, &HLength, &HRetCode);
64.  }