/* File format is:
*
* id number [9]
- * name (last, first middle) [30]
+ * last name [30]
+ * first name [30]
+ * middle name [30]
* office address [24]
* phone1 [12]
* phone2 [12]
#define LOC_ID 0
#define LEN_ID 9
-#define LOC_NAME (LOC_ID + LEN_ID)
-#define LEN_NAME 30
-#define LOC_OFFICE (LOC_NAME + LEN_NAME)
+#define LOC_LAST_NAME (LOC_ID + LEN_ID)
+#define LEN_LAST_NAME 30
+#define LOC_FIRST_NAME (LOC_LAST_NAME + LEN_LAST_NAME)
+#define LEN_FIRST_NAME 30
+#define LOC_MIDDLE_NAME (LOC_FIRST_NAME + LEN_FIRST_NAME)
+#define LEN_MIDDLE_NAME 30
+#define LOC_OFFICE (LOC_MIDDLE_NAME + LEN_MIDDLE_NAME)
#define LEN_OFFICE 24
#define LOC_PHONE (LOC_OFFICE + LEN_OFFICE)
#define LEN_PHONE 12
{
static struct entry e;
static char buf[BUFSIZ];
- static char name[LEN_NAME + 1], id[LEN_ID + 1];
+ static char last_name[LEN_LAST_NAME + 1], id[LEN_ID + 1];
+ static char first_name[LEN_FIRST_NAME + 1], middle_name[LEN_MIDDLE_NAME + 1];
static char office[LEN_OFFICE + 1], phone[LEN_PHONE + 1];
static char phone2[LEN_PHONE2 + 1], dept[LEN_DEPT + 1], title[LEN_TITLE + 1];
int ends_sr, ends_jr, ends_iii, ends_iv, ends_ii, ends_v;
return NULL;
strlcpy(id, &buf[LOC_ID], LEN_ID + 1);
- strlcpy(name, &buf[LOC_NAME], LEN_NAME + 1);
+ strlcpy(last_name, &buf[LOC_LAST_NAME], LEN_LAST_NAME + 1);
+ strlcpy(first_name, &buf[LOC_FIRST_NAME], LEN_FIRST_NAME + 1);
+ strlcpy(middle_name, &buf[LOC_MIDDLE_NAME], LEN_MIDDLE_NAME + 1);
strlcpy(office, &buf[LOC_OFFICE], LEN_OFFICE + 1);
strlcpy(phone, &buf[LOC_PHONE], LEN_PHONE + 1);
strlcpy(phone2, &buf[LOC_PHONE2], LEN_PHONE2 + 1);
strlcpy(dept, &buf[LOC_DEPT], LEN_DEPT + 1);
strlcpy(title, &buf[LOC_TITLE], LEN_TITLE + 1);
- p = strchr(name, ',');
- if (p)
- *p = '\0';
- e.last = strtrim(name);
- if (p)
- {
- p++;
- while (isspace(*p))
- p++;
- e.first = p;
- p = strchr(e.first, ' ');
- if (p)
- {
- *p = '\0';
- e.first = strtrim(e.first);
- e.middle = strtrim(p + 1);
- }
- else
- {
- e.first = strtrim(e.first);
- e.middle = "";
- }
- }
- else
- {
- e.first = "";
- e.middle = "";
- }
+ e.last = strtrim(last_name);
+ e.first = strtrim(first_name);
+ e.middle = strtrim(middle_name);
+
ends_sr = ends_jr = ends_iii = ends_iv = ends_ii = ends_v = 0;
LookForSt(e.last);
LookForO(e.last);
set head off
set feedback off
set pagesize 0
-set linesize 271
+set linesize 331
spool /moira/load/staff.input.unsorted
-select mit_id || rpad(nvl(full_name, ' '), 30, ' ') || rpad(substr(nvl(office_location, ' '), 0, 12), 12, ' ') || rpad(substr(nvl(secondary_office_location, ' '), 0, 12), 12, ' ') || lpad(substr(nvl(office_phone, ' '), 0, 12), 12, ' ') || lpad(substr(nvl(secondary_office_phone, ' '), 0, 12), 12, ' ') || rpad(substr(department_name, 0, 50), 50, ' ') || substr(directory_title, 0, 50) from wareuser.moira_employee;
+select mit_id || rpad(nvl(last_name, ' '), 30, ' ') || rpad(nvl(first_name, ' '), 30, ' ') || rpad(nvl(middle_name, ' '), 30, ' ') || rpad(substr(nvl(office_location, ' '), 0, 12), 12, ' ') || rpad(substr(nvl(secondary_office_location, ' '), 0, 12), 12, ' ') || lpad(substr(nvl(office_phone, ' '), 0, 12), 12, ' ') || lpad(substr(nvl(secondary_office_phone, ' '), 0, 12), 12, ' ') || rpad(substr(department_name, 0, 50), 50, ' ') || substr(directory_title, 0, 50) from wareuser.moira_employee;
spool off
quit