z/OS UNIX example

The example source files unit0.c, unit1.c, and unit2.c that are shown in Figure 1, are used to illustrate all of the z/OS® UNIX System Services examples that follow.

Figure 1. Example source files
  /* file: unit0.c */
  #include <stdio.h>
  extern int f1(void);
  extern int f4(void);
  int main(void) {
    int rc1;
    int rc4;
    rc1 = f1();
    rc4 = f4();
    if (rc1 != 1) printf("fail rc1 is %d\n",rc1);
    if (rc4 != 40) printf("fail rc4 is %d\n",rc4);
    return 0;
  }

  /* file: unit1.c */
  int f1(void) { return 1; }

 /* file: unit2.c */
 int f2(void) { return 20;}
 int f3(void) { return 30;}
 int f4(void) { return f2()*2; /* 40 */ }