John Forkosh Associates ®
A r c s C o m m   S o u r c e   L i s t i n g
Copyright © 1985-2010, John Forkosh Associates, Inc.
All rights reserved.

Click for:   homepage,   resume



  CCCCCCC    OOOOOO   NN      NN TTTTTTTTTT EEEEEEEEEE NN      NN TTTTTTTTTT   SSSSSSS 
 CCCCCCCCC  OOOOOOOO  NNN     NN TTTTTTTTTT EEEEEEEEEE NNN     NN TTTTTTTTTT  SSSSSSSSS
CC      CC OO      OO NNNN    NN TT  TT  TT  EE     EE NNNN    NN TT  TT  TT SS        
CC         OO      OO NN NN   NN     TT      EEEEEE    NN NN   NN     TT      SSSSSSS  
CC         OO      OO NN   NN NN     TT      EEEEEE    NN   NN NN     TT       SSSSSSS 
CC      CC OO      OO NN    NNNN     TT      EE     EE NN    NNNN     TT             SS
 CCCCCCCCC  OOOOOOOO  NN     NNN    TTTT    EEEEEEEEEE NN     NNN    TTTT    SSSSSSSSS 
  CCCCCCC    OOOOOO   NN      NN    TTTT    EEEEEEEEEE NN      NN    TTTT     SSSSSSS  

   1: arcsclnt.c
   2: arcscomm.h
   3: arcsproof.c
   4: arcsrpt.c
   5: arcssrvr.for
   6: arcsupdt.c
   7: arcsupdt.com
   8: arcsvalid.c
   9: client.c
  10: clientvms.c
  11: pdata.h
  12: phnxclnt.c
  13: phnxmst.inc
  14: phnxstat.h
  15: seqlib.c
  16: trnlog.c
  17: vmsmsg.c


     AA    RRRRRRRR     CCCCCCC    SSSSSSS    CCCCCCC  LLLLL      NN      NN TTTTTTTTTT
    AAAA   RRRRRRRRR   CCCCCCCCC  SSSSSSSSS  CCCCCCCCC LLLLL      NNN     NN TTTTTTTTTT
   AA  AA   RR     RR CC      CC SS         CC      CC  LL        NNNN    NN TT  TT  TT
  AA    AA  RRRRRRRR  CC          SSSSSSS   CC          LL        NN NN   NN     TT    
 AAAAAAAAA  RRRRRRR   CC           SSSSSSS  CC          LL        NN   NN NN     TT    
AAAAAAAAAA  RR   RR   CC      CC         SS CC      CC  LL     LL NN    NNNN     TT    
AA      AA  RR    RR   CCCCCCCCC SSSSSSSSS   CCCCCCCCC LLLLLLLLLL NN     NNN    TTTT   
AA      AA  RR     RR   CCCCCCC   SSSSSSS     CCCCCCC  LLLLLLLLLL NN      NN    TTTT   

  1: /****************************************************************************
  2:  *
  3:  * Copyright (c) 1985, John Forkosh Associates, Inc.  All rights reserved.
  4:  * --------------------------------------------------------------------------
  5:  *
  6:  * Function:    ARCSclnt
  7:  *
  8:  * Purpose:     Issues request for ARCS record to ARCSSRVR server task
  9:  *              running on VODKA, using transparent task-to-task communication.
 10:  *
 11:  * Call:        arcsclnt ( request, reply, nbytes )
 12:  *
 13:  * Arguments:
 14:  *              request (I)     addr of char string containing either key of
 15:  *                              record to be retrieved, or NEXT for sequential
 16:  *                              retrieval of next record.  Note: request = OPEN
 17:  *                              or CLOSE to open/close DECnet link, and a null
 18:  *                              request defaults to NEXT for your convenience.
 19:  *              reply (O)       addr of char string containing retrieved record
 20:  *                              (if RMS$_NORMAL returned).  Note that caller
 21:  *                              unions this string with struct of rec format.
 22:  *              nbytes (O)      addr of int returning number of bytes in reply
 23:  *                              (note: check nbytes on return to make sure that
 24:  *                              no unauthorized change in ARCSSRVR message
 25:  *                              format has occurred).
 26:  *
 27:  * Returns:     - int
 28:  *              RMS$_NORMAL     for successful retrieval of requested record
 29:  *              RMS$_QUO        couldn't open or close file
 30:  *              RMS$_FTM        couldn't write request
 31:  *              RMS$_NET        couldn't read reply
 32:  *
 33:  * Note:        To establish the DECnet link:
 34:  *              $define task "vodka""arcscomm phoenix""::""task=arcssrvr"""
 35:  *
 36:  * Source:      ARCSCLNT.C
 37:  *
 38:  * --------------------------------------------------------------------------
 39:  * Revision History:
 40:  *
 41:  * 12/18/85     J.Forkosh       Installation.
 42:  *
 43:  ****************************************************************************/
 44: 
 45: #include stdio
 46: #include rms
 47: /* ---------------------------------------------------------------------------
 48:    Global Variables
 49: --------------------------------------------------------------------------- */
 50: globalref int   msglevel;                       /* debugging message level */
 51: 
 52: arcsclnt ( request, reply, nbytes )
 53: char    *request;
 54: char    *reply;
 55: int     *nbytes;
 56: {
 57: 
 58: /* ---------------------------------------------------------------------------
 59:    Allocations and Declarations
 60: --------------------------------------------------------------------------- */
 61: static int      task_file;                      /* TASK file descriptor */
 62: char            task_request[128];              /* local copy of request */
 63: int             reply_len;                      /* #chars returned by server */
 64: 
 65: /* ---------------------------------------------------------------------------
 66:    Initialization
 67: --------------------------------------------------------------------------- */
 68: if ( msglevel > 99 )                            /* level of debugging output */
 69:         printf ("\nARCSclnt> request= %.32s", request );
 70: *nbytes = 0;                                    /* default no reply */
 71: 
 72: /* ---------------------------------------------------------------------------
 73:    Open/Close the task file when *request = OPEN/CLOSE, respectively.
 74: --------------------------------------------------------------------------- */
 75: if ( !strcmp(request,"OPEN") )                  /* OPEN requested */
 76:         {
 77:         if ((task_file = open("TASK",0002,0777,"mrs=512","shr=upi")) == -1)
 78:                 {
 79:                 if ( msglevel > 0 )
 80:                         printf("\nARCSclnt> Can't open() TASK file.");
 81:                 return ( RMS$_QUO );            /* can't open TASK */
 82:                 }
 83:         return ( RMS$_NORMAL );                 /* successfully opened */
 84:         }
 85: 
 86: if ( !strcmp(request,"CLOSE") )                 /* CLOSE requested */
 87:         {
 88:         close ( task_file );
 89:         return ( RMS$_NORMAL );                 /* ignore error returns */
 90:         }
 91: 
 92: /* ---------------------------------------------------------------------------
 93:    Issue request, read reply.
 94: --------------------------------------------------------------------------- */
 95: strcpy ( task_request, request );               /* local copy of request */
 96: if ( strlen(task_request) == 0 )                /* null request = NEXT */
 97:         strcpy(task_request,"NEXT");
 98: 
 99: if ( write(task_file,task_request,strlen(task_request)) == -1 )
100:         {
101:         if ( msglevel > 1 )
102:                 printf("\nARCSclnt> Can't write() request.");
103:         return ( RMS$_FTM );
104:         }
105: 
106: if ( (reply_len=read(task_file,reply,512)) == -1 )
107:         {
108:         if ( msglevel > 1 )
109:                 printf("\nARCSclnt> Can't read() reply");
110:         return ( RMS$_NET );
111:         }
112: 
113: /* ---------------------------------------------------------------------------
114:    Return reply to caller
115: --------------------------------------------------------------------------- */
116: *nbytes = reply_len;                            /* # bytes returned in reply */
117: return ( RMS$_NORMAL );
118: }


     AA    RRRRRRRR     CCCCCCC    SSSSSSS    CCCCCCC    OOOOOO   MM      MM MM      MM
    AAAA   RRRRRRRRR   CCCCCCCCC  SSSSSSSSS  CCCCCCCCC  OOOOOOOO  MMM    MMM MMM    MMM
   AA  AA   RR     RR CC      CC SS         CC      CC OO      OO MMMM  MMMM MMMM  MMMM
  AA    AA  RRRRRRRR  CC          SSSSSSS   CC         OO      OO MM MMMM MM MM MMMM MM
 AAAAAAAAA  RRRRRRR   CC           SSSSSSS  CC         OO      OO MM  MM  MM MM  MM  MM
AAAAAAAAAA  RR   RR   CC      CC         SS CC      CC OO      OO MM      MM MM      MM
AA      AA  RR    RR   CCCCCCCCC SSSSSSSSS   CCCCCCCCC  OOOOOOOO  MM      MM MM      MM
AA      AA  RR     RR   CCCCCCC   SSSSSSS     CCCCCCC    OOOOOO   MM      MM MM      MM

  1: /****************************************************************************
  2:  *
  3:  * Copyright (c) 1985, John Forkosh Associates, Inc.  All rights reserved.
  4:  * --------------------------------------------------------------------------
  5:  *
  6:  * Structures:  arcscomm_buf
  7:  *              arcsphnx_flds
  8:  *
  9:  * Purpose:     arcscomm_buf describes the message format used by ARCSsrvr
 10:  *              to send Route_Mst records across DECnet, and arcsphnx_flds
 11:  *              gives the positional correspondence of these fields in the
 12:  *              Phoenix static and dynamic customer data structures:
 13:  *
 14:  * Notes:       In principle, arcscomm_buf ought to EXACTLY CORRESPOND to the
 15:  *              include file PHNXMST.INC compiled with the DECnet partner task
 16:  *              ARCSsrvr.  But we actually use the offset table, so this struct
 17:  *              is for informational purposes only.
 18:  *
 19:  *              arcsphnx_flds contains the ARCS and Phoenix offsets and lengths
 20:  *              of equivalent fields on the two systems: it actually drives the
 21:  *              reconciliation and update process, and must always be in synch
 22:  *              with PHNXMST.INC.
 23:  *
 24:  *              Note slight Kludges where a negative Phoenix offset is used
 25:  *              to indicate dynamic cust data.  And a negative ARCS offset
 26:  *              indicates a dummy arg (e.g., usually used to denote a field
 27:  *              passed by ARCSsrvr but not stored by Phoenix in cust-file).
 28:  *
 29:  * Source:      ARCSCOMM.H
 30:  *
 31:  * --------------------------------------------------------------------------
 32:  * Revision History:
 33:  *
 34:  * 12/30/85     J.Forkosh       Installation.
 35:  *
 36:  ****************************************************************************/
 37: 
 38: /* ---------------------------------------------------------------------------
 39:    Position and length of keys in ARCSsrvr message (points to inst for test,
 40:    so DUPPOS and DUPLEN must point to dup field when system goes live.)
 41: --------------------------------------------------------------------------- */
 42: #define DUPPOS 37
 43: #define DUPLEN 25
 44: #define GCNPOS 0
 45: #define GCNLEN 5
 46: 
 47: /* ---------------------------------------------------------------------------
 48:    Fields not defined on ARCS are packed with ARCS_FILLER in the Xmitted msg.
 49: --------------------------------------------------------------------------- */
 50: #define ARCS_FILLER '?'
 51: 
 52: /* ---------------------------------------------------------------------------
 53:    ARCSsrvr replies are formatted as follows...
 54: --------------------------------------------------------------------------- */
 55:                                                 /* ------------------------ */
 56: struct  arcscomm_buf                            /* Fld Description          */
 57:         {                                       /* ------------------------ */
 58:         char            gcn[ 5];                /*   1 GCN Route Code       */
 59:         char            cty[ 3];                /*   2 City Code            */
 60:         char            ctn[26];                /*   3 City Name            */
 61:         char            cny[ 3];                /*   4 Country Code         */
 62:         char            nm1[72];                /*   5 Institution Name     */
 63:         char            bkw[ 4];                /*   6 Bankwire Code        */
 64:         char            tn1[13];                /*   7 1st Telex Number     */
 65:         char            ta1[20];                /*   8 1st Telex Answerback */
 66:         char            tn2[13];                /*   9 2nd Telex Number     */
 67:         char            ta2[20];                /*  10 2nd Telex Answerback */
 68:         char            tn3[13];                /*  11 3rd Telex Number     */
 69:         char            ta3[20];                /*  12 3rd Telex Answerback */
 70:         char            bid[19];                /*  13 Bank/Correspondent ID*/
 71:         char            aba[ 9];                /*  14 ABA Number           */
 72:         char            dda[ 8];                /*  15 DDA Number           */
 73:         char            mbc[ 4];                /*  16 Marti Bank Code      */
 74:         char            tfs[ 1];                /*  17 Test Flag - SENDS    */
 75:         char            dup[ 6];                /*  18 Date of Last Update  */
 76:         char            opr[ 2];                /*  19 Operator ID ("99")   */
 77:         char            sgm[ 5];                /*  20 System Msgs Route Cd */
 78:         char            mci[ 5];                /*  21 Master Cust Route Cd */
 79:         char            ovr[ 5];                /*  22 Override    Route Cd */
 80:         };                                      /* ------------------------ */
 81: 
 82: /* ---------------------------------------------------------------------------
 83:    This shows how ARCSsrvr msgs map onto Phoenix customer-data records...
 84: --------------------------------------------------------------------------- */
 85: #define DOMESTIC_FLD    17
 86: #define DOMROUTE_FLD    6
 87: #define FORROUTE_FLD    1
 88: 
 89: struct  {                                       /* ------------------------ */
 90:         char            fld_name[16];           /* Used to format reports   */
 91:         int             fld_len;                /* #bytes - same for both   */
 92:         int             arcs_offset;            /* #bytes preceding fld     */
 93:         int             phnx_offset;            /* + = static, - = dynamic  */
 94:         char            phnx_mask[32];          /* cust-file field template */
 95:         }                                       /* ------------------------ */
 96:         arcsphnx_flds[] =                       /* Fld Description          */
 97:         {                                       /* ------------------------ */
 98:         "Route Code",    5,   0, 124, "",       /*   1 Same as above        */
 99:         "City Code",     3,   5,  98, "",       /*   2                      */
100:         "City Name",    26,   8,  72, "",       /*   3                      */
101:         "Country Code",  3,  34, 101, "",       /*   4                      */
102:         "Institution",  72,  37,   0, "",       /*   5                      */
103:         "BankWire Code", 4, 109, 124, "",       /*   6                      */
104:         "Telex 1",      13, 113, 142, "",       /*   7                      */
105:         "AnswerBack 1", 20, 126, 156, "",       /*   8                      */
106:         "Telex 2",      13, 146, 178, "",       /*   9                      */
107:         "AnswerBack 2", 20, 159, 192, "",       /*  10                      */
108:         "Telex 3",      13, 179, 214, "",       /*  11                      */
109:         "AnswerBack 3", 20, 192, 228, "",       /*  12                      */
110:         "Bank ID",      19, 212, 104, "C",      /*  13                      */
111:         "ABA Number",    9, 231, 256, "",       /*  14                      */
112:         "DDA Number",    8, 240, 248, "",       /*  15                      */
113:         "MARTI Code",    4,-248,   0, "",       /*  16                      */
114:         "SENDS Flag",    1, 252, 330, "",       /*  17                      */
115:         "Last Update",   6,-253,   0, "",       /*  18                      */
116:         "Operator ID",   2,-259,   0, "",       /*  19                      */
117:         "System Route",  5, 261, 270, "",       /*  20                      */
118:         "Master Route",  5, 266, 290, "",       /*  21                      */
119:         "Override Route",5, 271, 310, "",       /*  22                      */
120:         "End-of-Table", -1,  -1,  -1, ""        /* ------------------------ */
121:         };
122: 
123: /* ============================ End-of-File =============================== */


     AA    RRRRRRRR     CCCCCCC    SSSSSSS  PPPPPPPP   RRRRRRRR     OOOOOO     OOOOOO  
    AAAA   RRRRRRRRR   CCCCCCCCC  SSSSSSSSS PPPPPPPPP  RRRRRRRRR   OOOOOOOO   OOOOOOOO 
   AA  AA   RR     RR CC      CC SS          PP     PP  RR     RR OO      OO OO      OO
  AA    AA  RRRRRRRR  CC          SSSSSSS    PPPPPPPP   RRRRRRRR  OO      OO OO      OO
 AAAAAAAAA  RRRRRRR   CC           SSSSSSS   PPPPPPP    RRRRRRR   OO      OO OO      OO
AAAAAAAAAA  RR   RR   CC      CC         SS  PP         RR   RR   OO      OO OO      OO
AA      AA  RR    RR   CCCCCCCCC SSSSSSSSS  PPPP        RR    RR   OOOOOOOO   OOOOOOOO 
AA      AA  RR     RR   CCCCCCC   SSSSSSS   PPPP        RR     RR   OOOOOO     OOOOOO  

  1: /****************************************************************************
  2:  *
  3:  * Copyright (c) 1985, John Forkosh Associates, Inc.  All rights reserved.
  4:  * --------------------------------------------------------------------------
  5:  *
  6:  * Function:    ARCSproof
  7:  *
  8:  * Purpose:     Reconciles a Phoenix customer record with an ARCS message.
  9:  *
 10:  * Call:        arcsproof ( opcode, arcsmsg, pdata, prfflds )
 11:  *
 12:  * Arguments:
 13:  *              opcode (I)      addr of char string containing "COMP" for
 14:  *                              compare only, "COPY" for compare and move
 15:  *                              updated fields from arcsmsg to pdata, or
 16:  *                              "INIT" to move all fields (no compare).
 17:  *              arcsmsg (I)     addr of char string containing ARCS message.
 18:  *              pdata (I)       addr of process data struct containing
 19:  *                              static and dynamic cust-data to be
 20:  *                              reconciled.
 21:  *              prfflds (O)     addr of int vector returning the sequence
 22:  *                              number (1=gcn,etc) of fields not agreeing.
 23:  *
 24:  * Returns:     - int           number of fields not agreeing, zero means
 25:  *                              no update required.
 26:  *
 27:  * Note:        strncmp() is used to compare fields, so they'd better all
 28:  *              be ascii chars (i.e., a NULL will stop strncmp prematurely).
 29:  *
 30:  * Source:      ARCSPROOF.C
 31:  *
 32:  * --------------------------------------------------------------------------
 33:  * Revision History:
 34:  *
 35:  * 01/03/86     J.Forkosh       Installation.
 36:  *
 37:  ****************************************************************************/
 38: 
 39: #include stdio
 40: #include "arcscomm.h"
 41: #include "pdata.h"
 42: /* ---------------------------------------------------------------------------
 43:    Global Variables
 44: --------------------------------------------------------------------------- */
 45: globalref int   msglevel;                       /* debugging message level */
 46: 
 47: arcsproof ( opcode, arcsmsg, pdata, prfflds )
 48: char    *opcode;
 49: char    *arcsmsg;
 50: struct  process_data *pdata;
 51: int     *prfflds;
 52: {
 53: 
 54: /* ---------------------------------------------------------------------------
 55:    Allocations and Declarations
 56: --------------------------------------------------------------------------- */
 57: int     nprf;                                   /* # fields not agreeing */
 58: int     iprf;                                   /* sequence # of field */
 59: int     skipprf;                                /* I/D field to be skipped */
 60: int     nbytes;                                 /* fld_len */
 61: int     arcsoff;                                /* arcs_offset */
 62: int     phnxoff;                                /* phnx_offset */
 63: char    *arcsptr,*phnxptr;                      /* char ptrs to arcs & phnx */
 64: char    arcsfld[256];                           /* mask & fld */
 65: char    *phnxmask;                              /* ptr to cust-file template */
 66: int     nmask,nfld;                             /* len of mask, tot fld len */
 67: static  int ncalls = 0;                         /* toggle for filler init */
 68: static  char arcs_filler[256];                  /* filler */
 69: 
 70: /* ---------------------------------------------------------------------------
 71:    Initialization
 72: --------------------------------------------------------------------------- */
 73: if ( msglevel > 99 )                            /* level of debugging output */
 74:         printf("\nARCSproof> %.4s arcs<%.25s> phnx<%.25s>",
 75:         opcode,arcsmsg,(char *)&(pdata->static_cust_data));
 76: if ( ncalls == 0 )                              /* init filler on 1st call */
 77:         for(ncalls=0;ncalls<256;ncalls++) arcs_filler[ncalls] = ARCS_FILLER;
 78: nprf = 0;                                       /* so far, so good */
 79: iprf = 0;                                       /* start at the beginning */
 80: 
 81: /* ---------------------------------------------------------------------------
 82:    Kludge to check for foreign/domestic indicator
 83:    (this requirement was conveyed by Randi during 1/24/86 meeting)
 84: --------------------------------------------------------------------------- */
 85: skipprf = -1;                                   /* init to no skips */
 86: arcsptr = arcsmsg + arcsphnx_flds[DOMESTIC_FLD-1].arcs_offset; /* ptr to I/D */
 87: if ((*arcsptr == 'I')
 88: ||  (*arcsptr == 'N')) skipprf= DOMROUTE_FLD-1; /* Int'l, so skip domestic */
 89: if ( *arcsptr == 'D' )
 90:         {                                       /* check domestic non-blank */
 91:         arcsptr = arcsmsg + arcsphnx_flds[DOMROUTE_FLD-1].arcs_offset;
 92:         for (nbytes=0; nbytes<32; nbytes++)     /* strncpy won't 0 term. so */
 93:                 arcsfld[nbytes]='\000';         /* all nulls to start */
 94:         nbytes = arcsphnx_flds[DOMROUTE_FLD-1].fld_len; /* len of DOMROUTE */
 95:         strncpy(arcsfld,arcsptr,nbytes);        /* local copy of DOMROUTE */
 96:         arcsfld[nbytes] = '\000';               /* NULL-terminated */
 97:         if( (strlen(arcsfld) == nbytes)         /* if we have a DOMROUTE_FLD */
 98:         &&  strncmp(arcsfld,"        ",nbytes) )/* and it's non-blank */
 99:                 skipprf= FORROUTE_FLD-1;        /* Domestic, so skip int'l */
100:         else
101:                 skipprf= DOMROUTE_FLD-1;        /* skip blank domestic field */
102:         }
103: 
104: /* ---------------------------------------------------------------------------
105:    Run through arcsphnx_flds until -1 fld_len indicates end-of-table
106: --------------------------------------------------------------------------- */
107: while ( (nbytes = arcsphnx_flds[iprf].fld_len) > 0 )    /* trailer is -1 */
108:         {
109:         if ( (iprf != skipprf)                  /* skip int'l or domestic */
110:         &&   (arcsoff = arcsphnx_flds[iprf].arcs_offset) >= 0 )/* <0 is stub */
111:                 {
112:                 phnxoff = arcsphnx_flds[iprf].phnx_offset;
113:                 arcsptr = arcsmsg + arcsoff;
114:                 nmask = strlen((phnxmask = arcsphnx_flds[iprf].phnx_mask));
115:                 nfld = nmask + nbytes;          /* tot fld len = mask + arcs */
116:                 strcpy(arcsfld,phnxmask);       /* start with mask */
117:                 strncat(arcsfld,arcsptr,nbytes);/* concat arcs field */
118:                 arcsfld[nfld] = '\000';         /* NULL-terminated */
119:                 if ( phnxoff >= 0 )             /* use static_cust_data */
120:                         phnxptr= (char *)&(pdata->static_cust_data) + phnxoff;
121:                 else                            /* use dynamic_cust_data */
122:                         phnxptr= (char *)&(pdata->dynamic_cust_data) - phnxoff;
123:                 if ( msglevel > 199 )
124:                         printf("\nARCSproof> fld#%2d len=%2d <%.25s> <%.25s>",
125:                         iprf,nbytes,arcsfld,phnxptr);
126:                 if ( !strcmp(opcode,"INIT") )   /* always copy for INIT */
127:                         strncpy(phnxptr,arcsfld,nfld);
128:                 if (strncmp(arcsfld,phnxptr,nfld)       /* (a) ARCS!=Phoenix */
129:                 &&  strncmp(arcsptr,arcs_filler,nbytes))/* (b) ARCS!=filler */
130:                         {                               /* fields not equal */
131:                         prfflds[nprf++] = iprf;         /* so record field # */
132:                         if ( !strcmp(opcode,"COPY") )   /* and copy if asked */
133:                                 strncpy(phnxptr,arcsfld,nfld);
134:                         }
135:                 }
136:         iprf++;
137:         }
138: 
139: /* ---------------------------------------------------------------------------
140:    Return to caller
141: --------------------------------------------------------------------------- */
142: return ( nprf );
143: }


     AA    RRRRRRRR     CCCCCCC    SSSSSSS  RRRRRRRR   PPPPPPPP   TTTTTTTTTT           
    AAAA   RRRRRRRRR   CCCCCCCCC  SSSSSSSSS RRRRRRRRR  PPPPPPPPP  TTTTTTTTTT           
   AA  AA   RR     RR CC      CC SS          RR     RR  PP     PP TT  TT  TT           
  AA    AA  RRRRRRRR  CC          SSSSSSS    RRRRRRRR   PPPPPPPP      TT       .       
 AAAAAAAAA  RRRRRRR   CC           SSSSSSS   RRRRRRR    PPPPPPP       TT      ...      
AAAAAAAAAA  RR   RR   CC      CC         SS  RR   RR    PP            TT     .....     
AA      AA  RR    RR   CCCCCCCCC SSSSSSSSS   RR    RR  PPPP          TTTT     ...      
AA      AA  RR     RR   CCCCCCC   SSSSSSS    RR     RR PPPP          TTTT      .       

  1: /****************************************************************************
  2:  *
  3:  * Copyright (c) 1985, John Forkosh Associates, Inc.  All rights reserved.
  4:  * --------------------------------------------------------------------------
  5:  *
  6:  * Function:    ARCSrpt
  7:  *
  8:  * Purpose:     Write update report for a single customer record.
  9:  *
 10:  * Call:        arcsrpt ( rptptr, arcsmsg, pdata, nprf, prfflds )
 11:  *
 12:  * Arguments:
 13:  *              rptptr (I)      addr of FILE struct to report file,
 14:  *                              as returned by fopen().
 15:  *              arcsmsg (I)     addr of char string containing ARCS message.
 16:  *              pdata (I)       addr of process data struct containing
 17:  *                              static and dynamic cust-data to be
 18:  *                              reported.
 19:  *              nprf (I)        int containing number of prfflds below.  If
 20:  *                              nprf=0 indicates initial customer record,
 21:  *                              nprf<0 to print report trailer at end of job.
 22:  *              prfflds (I)     addr of int vector containing the sequence
 23:  *                              number (1=gcn,etc) of fields not agreeing.
 24:  *
 25:  * Returns:     - int
 26:  *
 27:  * Source:      ARCSRPT.C
 28:  *
 29:  * --------------------------------------------------------------------------
 30:  * Revision History:
 31:  *
 32:  * 01/08/86     J.Forkosh       Installation.
 33:  *
 34:  ****************************************************************************/
 35: 
 36: #include stdio
 37: #include "arcscomm.h"
 38: #include "pdata.h"
 39: 
 40: /* ---------------------------------------------------------------------------
 41:    Global Variables
 42: --------------------------------------------------------------------------- */
 43: globalref int   msglevel;                       /* debugging message level */
 44: 
 45: arcsrpt ( rptptr, arcsmsg, pdata, nprf, prfflds )
 46: FILE    *rptptr;
 47: char    *arcsmsg;
 48: struct  process_data *pdata;
 49: int     nprf;
 50: int     *prfflds;
 51: {
 52: 
 53: /* ---------------------------------------------------------------------------
 54:    Allocations and Declarations
 55: --------------------------------------------------------------------------- */
 56: int     ifld,nfld;                              /* index over nprf */
 57: int     iprf;                                   /* field number */
 58: int     nbytes,nmask;                           /* fld_len, mask len */
 59: int     arcsoff;                                /* arcs_offset */
 60: int     phnxoff;                                /* phnx_offset */
 61: char    *arcsptr,*phnxptr;                      /* char ptrs to arcs & phnx */
 62: char    arcsfld[256],phnxfld[256];              /* local copies of fields */
 63: char    *stub_name;                             /* char ptr to field name */
 64: char    *hdr_ptrs[8];                           /* char ptrs to hdr fields */
 65: static  int nlines = 99, maxlines = 60;         /* num lines on page */
 66: static  int npages = 0;                         /* page number */
 67: static  int hdr_flds[] = {0,3,4,-1};            /* GCN,Country,Inst. */
 68: int     ihdr;                                   /* index for hdr_lines */
 69: 
 70: /* ---------------------------------------------------------------------------
 71:    Report Layouts
 72: ------------------------------------------------------------------------------
 73:           1         2         3         4         5         6         7
 74: "1234567890123456789012345678901234567890123456789012345678901234567890123456"
 75: --------------------------------------------------------------------------- */
 76: static  char *hdr_lines[] =
 77: {
 78: "                        ARCSCOMM/PHOENIX UPDATE REPORT                      ",
 79: "     ---------------------------------------------------------------------  ",
 80: " ",
 81: " ",
 82: " ",
 83: ""
 84: };
 85: static  char *hdr_fmt =
 86: "\n     ROUTE CODE: %-5.5s  COUNTRY: %-3.3s  NAME: %-.32s";
 87: static  char *fld_fmt =
 88: "\n     %-12.12s     %-25.25s    %-25.25s";
 89: static  char *fld_ftr =
 90: "\n     ---------------------------------------------------------------------";
 91: static  char *pg_ftr =
 92: "\n                              --  Page %d  --\f";
 93: 
 94: /* ---------------------------------------------------------------------------
 95:    Initialization
 96: --------------------------------------------------------------------------- */
 97: if ( msglevel > 99 )                            /* level of debugging output */
 98:         {
 99:         printf("\nARCSrpt> arcs<%.25s> phnx<%.25s>",
100:         arcsmsg,(char *)&(pdata->static_cust_data));
101:         }
102: if( (nfld=(nprf>0)?nprf:0) == 0 )               /* new record or update ? */
103:         while(arcsphnx_flds[nfld].fld_len>=0) nfld++;
104: if ( nprf<0 ) nfld=99;                          /* kicker for final footer */
105: 
106: /* ---------------------------------------------------------------------------
107:    Print header
108: --------------------------------------------------------------------------- */
109: /* --- first "foot" previous customer --- */
110: if ( npages > 0 )                               /* don't foot before 1st pg */
111:         {
112:         fprintf(rptptr,fld_ftr);                /* footer */
113:         fprintf(rptptr,"\n\n");                 /* and white space */
114:         nlines += 3;                            /* and bump line counter */
115:         }
116: 
117: /* --- now check for required page break --- */
118: if ( nlines + nfld + 5 > maxlines )             /* can't finish on this page */
119:         {                                       /* so we need a page break */
120:         if ( npages > 0 )
121:                 {                               /* print footer except pg 1 */
122:                 while ( nlines++ < maxlines )
123:                         fprintf(rptptr,"\n");   /* skip to bottom of page */
124:                 fprintf(rptptr,pg_ftr,npages);  /* and print footer */
125:                 }
126:         if ( nfld>maxlines ) return;            /* trap end-of-job footer */
127:         npages++;                               /* bump page counter */
128:         for ( nlines=0; strlen(hdr_lines[nlines])>0; nlines++ )
129:                 fprintf(rptptr,"\n%s",hdr_lines[nlines]); /* print header */
130:         }
131: 
132: /* --- print header lines for this customer update --- */
133: for ( ihdr=0; (iprf=hdr_flds[ihdr]) >= 0; ihdr++ ) /* get hdr flds */
134:         hdr_ptrs[ihdr] = arcsmsg + arcsphnx_flds[iprf].arcs_offset;
135: fprintf(rptptr,hdr_fmt, hdr_ptrs[0],hdr_ptrs[1],hdr_ptrs[2]);
136: fprintf(rptptr,fld_ftr);
137: fprintf(rptptr,fld_fmt, "FIELD NAME","ARCS VALUE","PHOENIX VALUE");
138: fprintf(rptptr,fld_fmt, "----------","----------","-------------");
139: nlines += 4;                                    /* bump line counter */
140: 
141: /* ---------------------------------------------------------------------------
142:    Run through unreconciled fields indicated in prfflds
143: --------------------------------------------------------------------------- */
144: /* --- loop through fields --- */
145: for ( ifld=0; ifld < nfld; ifld++ )
146:         {
147:         if( nprf > 0 )                          /* got an updated cust... */
148:                 iprf = prfflds[ifld];           /* ...so lookup prfflds */
149:         else                                    /* got a new cust... */
150:                 iprf=ifld;                      /* ...so shoot the works */
151:         stub_name=arcsphnx_flds[iprf].fld_name;
152:         nbytes  = arcsphnx_flds[iprf].fld_len;
153:         nmask   = strlen(arcsphnx_flds[iprf].phnx_mask);
154:         arcsoff = arcsphnx_flds[iprf].arcs_offset;
155:         phnxoff = arcsphnx_flds[iprf].phnx_offset;
156:         arcsptr = arcsmsg + arcsoff;
157:         if ( phnxoff >= 0 )                     /* use static_cust_data */
158:                 phnxptr = (char *)&(pdata->static_cust_data) + phnxoff;
159:         else                                    /* use dynamic_cust_data */
160:                 phnxptr = (char *)&(pdata->dynamic_cust_data)- phnxoff;
161:         if ( arcsoff >= 0 )
162:                 {                               /* >=0 means real field */
163:                 strncpy(arcsfld,arcsptr,nbytes);/* local copies... */
164:                 strncpy(phnxfld,phnxptr,nbytes+nmask);
165:                 arcsfld[nbytes] = phnxfld[nbytes+nmask] = '\000';/* NULLs */
166:                 }
167:         else
168:                 {                               /* <0 means dummy field */
169:                 strcpy(arcsfld,"dummy field");
170:                 phnxfld[0] = '\000';
171:                 }
172:         if( nprf==0 )
173:                 {                               /* we're doing new cust ... */
174:                 phnxfld[0]='\000';              /* print blanks except line1 */
175:                 if( ifld==0 )
176:                         strcpy(phnxfld,"---NEW CUSTOMER---");
177:                 }
178:         fprintf(rptptr, fld_fmt, stub_name,arcsfld,phnxfld);/* print them */
179:         nlines++;                               /* bump line counter */
180:         }
181: 
182: /* ---------------------------------------------------------------------------
183:    Return to caller
184: --------------------------------------------------------------------------- */
185: return;
186: }


     AA    RRRRRRRR     CCCCCCC    SSSSSSS    SSSSSSS  RRRRRRRR   VV      VV RRRRRRRR  
    AAAA   RRRRRRRRR   CCCCCCCCC  SSSSSSSSS  SSSSSSSSS RRRRRRRRR  VV      VV RRRRRRRRR 
   AA  AA   RR     RR CC      CC SS         SS          RR     RR VV      VV  RR     RR
  AA    AA  RRRRRRRR  CC          SSSSSSS    SSSSSSS    RRRRRRRR  VV      VV  RRRRRRRR 
 AAAAAAAAA  RRRRRRR   CC           SSSSSSS    SSSSSSS   RRRRRRR    VV    VV   RRRRRRR  
AAAAAAAAAA  RR   RR   CC      CC         SS         SS  RR   RR     VV  VV    RR   RR  
AA      AA  RR    RR   CCCCCCCCC SSSSSSSSS  SSSSSSSSS   RR    RR     VVVV     RR    RR 
AA      AA  RR     RR   CCCCCCC   SSSSSSS    SSSSSSS    RR     RR     VV      RR     RR

  1: C/*****************************************************************************
  2: C *
  3: C * Copyright (c) 1985, John Forkosh Associates, Inc.  All rights reserved.
  4: C * --------------------------------------------------------------------------
  5: C *
  6: C * PROGRAM:    ARCSSRVR
  7: C *
  8: C * PURPOSE:    READS REQUEST FOR ARCS RECORD FROM PHOENIX CLIENT TASK
  9: C *             USING TRANSPARENT TASK-TO-TASK DECNET COMMUNICATION,
 10: C *             AND RETURNS THE REQUESTED RECORD.
 11: C *
 12: C * CALL:       $ RUN ARCSSRVR
 13: C *             (NOTE: ARCSSRVR MUST BE RUN FROM PROCEDURE ARCSSRVR.COM,
 14: C *             WHICH IS POINTED TO ON THE CLIENT MACHINE BY:
 15: C *             $ DEF TASK "VODKA""ARCSCOMM PHOENIX""::""TASK=ARCSSRVR.COM""")
 16: C *
 17: C * ARGUMENTS:  NONE - ALL INPUT READ FROM 'SYS$NET'
 18: C *
 19: C * SOURCE:     ARCSSRVR.FOR
 20: C *
 21: C * ---------------------------------------------------------------------------
 22: C * REVISION HISTORY:
 23: C *
 24: C * 12/19/85  J.FORKOSH         INSTALLATION
 25: C *
 26: C ****************************************************************************/
 27: 
 28: C ----------------------------------------------------------------------------
 29:         PROGRAM ARCSSRVR
 30: C ----------------------------------------------------------------------------
 31: C ----- GLOBAL VARIABLES
 32:         INCLUDE 'ROUTEMST.INC'                  ! ROUTE_MST RECORD LAYOUT
 33:         INCLUDE 'PHNXMST.INC'                   ! PHOENIX BUFFER RECORD LAYOUT
 34: 
 35: C ----- LOCAL VARIABLES
 36:         CHARACTER RTEMST_KEY*50                 ! KEY SENT TO SERVER BY CLIENT
 37:         CHARACTER ARCSCOMM_BUF*512              ! BUFFER RETURNED TO CLIENT
 38:         INTEGER KEY_ID/5/                       ! RMS KEYID
 39:         INTEGER DECNET_UNIT/1/, ROUTE_UNIT/2/,  ! FORTRAN UNIT #'S
 40:      +          CITY_UNIT/3/
 41: 
 42: C -----------------------------------------------------------------------------
 43: C       OPEN FILES TO DECNET PARTNER ON SYS$NET AND TO ROUTE_MST AND CITY_TBL.
 44: C -----------------------------------------------------------------------------
 45:         OPEN    (
 46:      +          UNIT=DECNET_UNIT,
 47:      +          NAME='SYS$NET',
 48:      +          TYPE='OLD',
 49:      +          FORM='FORMATTED',
 50:      +          ACCESS='SEQUENTIAL',
 51:      +          RECORDSIZE=512,
 52:      +          CARRIAGECONTROL='NONE'
 53:      +          )
 54: 
 55:         OPEN    (
 56:      +          UNIT=ROUTE_UNIT,
 57:      +          NAME='ROUTE_MST',
 58:      +          TYPE='OLD',
 59:      +          FORM='UNFORMATTED',
 60:      +          ORGANIZATION='INDEXED',
 61:      +          ACCESS='KEYED',
 62:      +          READONLY,
 63:      +          SHARED,
 64:      +          RECORDTYPE='FIXED',
 65:      +          RECORDSIZE=128,
 66:      +          BLOCKSIZE=4096,
 67:      +          ERR=1000,
 68:      +          IOSTAT=IOS
 69:      +          )
 70: 
 71:         OPEN    (
 72:      +          UNIT=CITY_UNIT,
 73:      +          NAME='CITY_TBL',
 74:      +          STATUS='OLD',
 75:      +          ACCESS='KEYED',
 76:      +          FORM='UNFORMATTED',
 77:      +          DISP='SAVE',
 78:      +          RECORDTYPE='FIXED', 
 79:      +          BUFFERCOUNT=2,
 80:      +          SHARED,
 81:      +          ERR=1000
 82:      +          )
 83: 
 84: C ----------------------------------------------------------------------------
 85: C       LOOP FOREVER, SERVING CLIENT UNTIL EOF ON SYS$NET
 86: C ----------------------------------------------------------------------------
 87:         DO 999 WHILE (.TRUE.)
 88: 
 89: C ----- WAIT ON READ FOR NEXT CLIENT REQUEST OR EOF FOR END
 90:         READ(DECNET_UNIT,100,END=1000,ERR=910) RTEMST_KEY
 91:   100   FORMAT(A)
 92: 
 93: C ----- REQUEST FORMAT IS 'NEXT' FOR SEQUENTIAL ACCESS, OR KEY VALUE
 94:   200   IF(RTEMST_KEY(1:4).EQ.'NEXT') THEN      ! SEQUENTIAL ACCESS REQUESTED
 95:                 READ (ROUTE_UNIT,END=920,ERR=910) RTEBUF
 96:         ELSE                                    ! GOT A KEYED ACCESS REQUEST
 97:                 READ (ROUTE_UNIT,KEYID=KEY_ID,KEYGE=RTEMST_KEY,IOSTAT=IOS,
 98:      +          ERR=910) RTEBUF
 99:         END IF
100: 
101: C ----- FORMAT A ARCSCOMM MESSAGE BUFFER AND RETURN IT
102:         CALL ARCSCOMM_MSG ( RTEBUF, PHX_FILLER, ARCSCOMM_BUF, NBYTES )
103:         IF(NBYTES.LT.0) THEN                    ! CHECK RETURN FOR DUMMY RECORD
104:                 RTEMST_KEY(1:4) = 'NEXT'        ! TRY NEXT REC IF CURRENT DUMMY
105:                 GOTO 200
106:         END IF
107:         WRITE(DECNET_UNIT,100) ARCSCOMM_BUF(1:NBYTES)   ! WRITE MSG TO CLIENT
108:         GOTO 999                                ! GO WAIT FOR NEXT REQUEST
109: 
110: C ----- ERR/EOF RETURNS
111:   910   WRITE(DECNET_UNIT,915)                  ! WRITE ERROR MSG TO CLIENT
112:   915   FORMAT('***ERR***')
113:         GOTO 999
114:   920   WRITE(DECNET_UNIT,925)                  ! WRITE EOF ON ROUTE_MST MSG
115:   925   FORMAT('***END***')
116:         GOTO 999
117: 
118:   999   END DO
119: 
120: C ----------------------------------------------------------------------------
121: C       END OF JOB, CLOSE FILES AND EXIT.
122: C ----------------------------------------------------------------------------
123:  1000   CLOSE (UNIT=DECNET_UNIT)
124:         CLOSE (UNIT=ROUTE_UNIT)
125:         CALL EXIT
126:         END
127: 
128: C *****************************************************************************
129: C *
130: C * SUBROUTINE: ARCSCOMM_MSG
131: C *
132: C * PURPOSE:    PRODUCES A PHOENIX-FORMATTED MESSAGE FROM AN ARCS RECORD.
133: C *
134: C * CALL:       ARCSCOMM_MSG ( RTEBUF, FILLER, ARCSCOMM_BUF, NBYTES )
135: C *
136: C * ARGUMENTS:
137: C *             RTEBUF (I)      CHAR*512 RECORD FROM ROUTE_MST DATABASE.
138: C *             FILLER (I)      CHAR*1 BYTE TO PACK IN UNDEFINED FIELDS.
139: C *             ARCSCOMM_BUF(O) CHAR*512 MESSAGE TO BE SHIPPED BACK TO CLIENT.
140: C *             NBYTES (O)      INT NUMBER OF BYTES RETURNED IN ARCSCOMM_BUF,
141: C *                             OR -1 IF RTEBUF IS A DUMMY RECORD.
142: C *
143: C * ---------------------------------------------------------------------------
144: C * REVISION HISTORY:
145: C *
146: C * 12/19/85  J.FORKOSH         INSTALLATION
147: C *
148: C *****************************************************************************
149: 
150: C ----------------------------------------------------------------------------
151:         SUBROUTINE ARCSCOMM_MSG ( RTEBUF, FILLER, ARCSCOMM_BUF, NBYTES )
152: C ----------------------------------------------------------------------------
153: C ----- ARGUMENTS
154:         CHARACTER RTEBUF*512
155:         CHARACTER FILLER*1
156:         CHARACTER ARCSCOMM_BUF*512
157:         INTEGER NBYTES
158: 
159: C ----- GLOBAL VARIABLES
160:         INTEGER*2 N_PHX_FIELDS,                 ! # FIELDS IN ARCSCOMM_BUF
161:      +          PHX_LAYOUT(2,32)                ! POS IN RTEBUF, LENGTH, ...
162:         COMMON/PHX_FORM/ N_PHX_FIELDS, PHX_LAYOUT
163: 
164: C ----- LOCAL VARIABLES
165:         INTEGER IFIELD,                         ! LOOP OVER N_PHX_FIELDS
166:      +          IBYTE,                          ! DUMMY TO LOOP OVER FILLER
167:      +          RTE_BYTE1,                      ! 1ST BYTE=PHX_LAYOUT(1,IFIELD)
168:      +          RTE_BYTE2,                      ! LAST BYTE IN RTEBUF
169:      +          PHX_BYTE1,                      ! 1ST BYTE=CURRENT NBYTES + 1
170:      +          PHX_BYTE2                       ! LAST BYTE IN ARCSCOMM_BUF
171:         INTEGER CITY_UNIT                       ! KLUDGE TO READ CITY_TBL
172:         CHARACTER CITY_REC*32                   ! BUFFER FOR CITY_TBL RECORD
173:         CHARACTER CITY_CODE*3                   ! CITY CODE FROM RTEBUF
174:         LOGICAL DUMMY_REC                       ! TOGGLE FOR DUMMY RECORDS
175: 
176: C ----------------------------------------------------------------------------
177: C       INITIALIZATION.
178: C ----------------------------------------------------------------------------
179:         DUMMY_REC = .FALSE.                     ! WILL BE TOGGLED IF NECESSARY.
180:         NBYTES = 0                              ! NOTHING VENTURED YET.
181:         CITY_UNIT = 3                           ! THAT'S WHERE MAIN OPENED IT.
182: 
183: C ----------------------------------------------------------------------------
184: C       CHECK FOR DUMMY RECORDS.
185: C ----------------------------------------------------------------------------
186:         DO 99 I=1,2                             ! SEVERAL FIELDS INDICATE DUMMY
187:    99   IF ( 1 .GT. 2 ) DUMMY_REC = .TRUE.      ! DON'T KNOW WHAT TO CHECK YET
188:         IF ( DUMMY_REC ) THEN
189:                 NBYTES = -1                     ! TELL CALLER HE GAVE US DUMMY
190:                 RETURN                          ! AND GO HOME.
191:         END IF
192: 
193: C ----------------------------------------------------------------------------
194: C       LOOP OVER ALL FIELDS DEFINED IN PHX_LAYOUT, CONCATANATING THEM TO BUF.
195: C ----------------------------------------------------------------------------
196:         DO 999 IFIELD = 1, N_PHX_FIELDS
197:         PHX_BYTE1 = NBYTES + 1                  ! START THIS FIELD 1 BYTE OVER
198:         PHX_BYTE2 = NBYTES + PHX_LAYOUT(2,IFIELD)
199:         RTE_BYTE1 = PHX_LAYOUT(1,IFIELD)
200:         IF ( RTE_BYTE1 .GT. 0 ) THEN            ! COPY RTEBUF IF FIELD DEFINED
201:                 RTE_BYTE2 = RTE_BYTE1 + PHX_LAYOUT(2,IFIELD) - 1        
202:                 ARCSCOMM_BUF(PHX_BYTE1:PHX_BYTE2) = RTEBUF(RTE_BYTE1:RTE_BYTE2)
203:         ELSE                                    ! CHECK FOR VARIOUS KLUDGES ...
204: C ----- KLUDGES ... FIRST DEFAULT FIELD TO FILLER
205:                 DO 910 IBYTE = PHX_BYTE1, PHX_BYTE2
206:   910           ARCSCOMM_BUF(IBYTE:IBYTE) = FILLER
207: C ----- CHECK IF IT'S THE CITY_NAME FIELD
208:                 IF ( - RTE_BYTE1 .EQ. CITY_UNIT ) THEN
209:                         CITY_CODE = RTEBUF(7:9)
210:                         CALL READ_CITY_TBL(CITY_UNIT,1,CITY_CODE,CITY_REC,IOS)
211:                         IF(IOS.EQ.0) ARCSCOMM_BUF(PHX_BYTE1:PHX_BYTE2)=CITY_REC
212:                 END IF
213: C ----- CHECK IF IT'S THE OPR FIELD
214:                 IF ( - RTE_BYTE1 .EQ. 99 ) THEN
215:                         ARCSCOMM_BUF(PHX_BYTE1:PHX_BYTE2) = '999999999'
216:                 END IF
217:         END IF
218:         NBYTES = NBYTES + PHX_LAYOUT(2,IFIELD)  ! BUMP BUFFER LENGTH
219:   999   CONTINUE
220: 
221: C ----------------------------------------------------------------------------
222: C       RETURN COMPLETED ARCSCOMM_BUF TO CALLER.
223: C ----------------------------------------------------------------------------
224:         RETURN
225:         END
226: 
227: C *****************************************************************************
228: C *
229: C * SUBROUTINE: READ_CITY_TBL
230: C *
231: C * PURPOSE:    READS A RECORD FROM CITY_TBL.
232: C *
233: C * CALL:       READ_CITY_TBL
234: C *             ( CITY_UNIT, KEY_ID, KEY_VALUE, CITY_REC, FOR_IOS )
235: C *
236: C * ARGUMENTS:
237: C *             CITY_UNIT (I)   INT UNIT ON WHICH CITY_TBL IS OPENED.
238: C *             KEY_ID (I)      INT FORTRAN KEYID FOR KEYED ACCESS --
239: C *                             0=CITY NAME, 1=CITY CODE, 2=COUNTRY CODE,
240: C *                             OR KEYID < 0 FOR SEQUIENTIAL READ.
241: C *             KEY_VALUE (I)   CHAR*(*) KEY TO BE RETRIEVED (DUMMY IF
242: C *                             KEYID<0).
243: C *             CITY_REC (O)    CHAR*(CTYBUF_L) RETURNED RECORD.
244: C *             FOR_IOS (O)     INT 0=SUCCESSFUL, 1=ERR, 2=END.
245: C *
246: C * ---------------------------------------------------------------------------
247: C * REVISION HISTORY:
248: C *
249: C * 12/31/85  J.FORKOSH         INSTALLATION (MODIFIED FROM SIMILAR ROUTINE
250: C *                             IN PROGRAM MNCITY.FOR)
251: C *
252: C *****************************************************************************
253: 
254: C ----------------------------------------------------------------------------
255:         SUBROUTINE READ_CITY_TBL
256:      +  ( CITY_UNIT, KEY_ID, KEY_VALUE, CITY_REC, FOR_IOS )
257: C ----------------------------------------------------------------------------
258: C ----- GLOBAL VARIABLES
259:         INCLUDE 'CITY.INC'                      ! CITY_TBL RECORD LAYOUT
260: 
261: C ----- ARGUMENTS
262:         INTEGER CITY_UNIT, KEY_ID, FOR_IOS
263:         CHARACTER KEY_VALUE*(*), CITY_REC*(CTYBUF_L)
264: 
265: C ----------------------------------------------------------------------------
266: C       ISSUE READ -- KEYED IF KEY_ID .GE. 0, ELSE SEQUENTIAL.
267: C ----------------------------------------------------------------------------
268:         IF ( KEY_ID .GE. 0 ) THEN
269:                 READ (CITY_UNIT, KEYID=KEY_ID, KEY=KEY_VALUE,
270:      +          IOSTAT=IOS, ERR=100) CTYBUF
271:         ELSE
272:                 READ (CITY_UNIT, IOSTAT=IOS, END=200, ERR=100) CTYBUF
273:         END IF
274:         CITY_REC = CTYBUF
275:         FOR_IOS = 0
276:         RETURN
277: 
278: C ----------------------------------------------------------------------------
279: C       END/ERR RETURNS
280: C ----------------------------------------------------------------------------
281:   100   FOR_IOS = 1
282:         RETURN
283:   200   FOR_IOS = 2
284:         RETURN
285:         END


     AA    RRRRRRRR     CCCCCCC    SSSSSSS  UUUU  UUUU PPPPPPPP   DDDDDDDD   TTTTTTTTTT
    AAAA   RRRRRRRRR   CCCCCCCCC  SSSSSSSSS UUUU  UUUU PPPPPPPPP  DDDDDDDDD  TTTTTTTTTT
   AA  AA   RR     RR CC      CC SS          UU    UU   PP     PP  DD     DD TT  TT  TT
  AA    AA  RRRRRRRR  CC          SSSSSSS    UU    UU   PPPPPPPP   DD     DD     TT    
 AAAAAAAAA  RRRRRRR   CC           SSSSSSS   UU    UU   PPPPPPP    DD     DD     TT    
AAAAAAAAAA  RR   RR   CC      CC         SS  UU    UU   PP         DD     DD     TT    
AA      AA  RR    RR   CCCCCCCCC SSSSSSSSS    UUUUUU   PPPP       DDDDDDDDD     TTTT   
AA      AA  RR     RR   CCCCCCC   SSSSSSS      UUUU    PPPP       DDDDDDDD      TTTT   

  1: /****************************************************************************
  2:  *
  3:  * Copyright (c) 1985, John Forkosh Associates, Inc.  All rights reserved.
  4:  * --------------------------------------------------------------------------
  5:  *
  6:  * Program:     ARCSupdt
  7:  *
  8:  * Purpose:     Main routine for ARCScomm/Phoenix Automated ARCS-to-Phoenix
  9:  *              Update Facility.  Drives the reconciliation/update process by:
 10:  *              1. retrieving all recently-updated ARCS records,
 11:  *              2. reconciling them with corresponding customer records,
 12:  *              3. requesting user validation (if required),
 13:  *              4. writing and logging updated customer records.
 14:  *
 15:  * Call:        $ arcsupdt "date-of-last-update" "flow-control"
 16:  *              (Note: $arcsupdt :== $device:[]arcsupdt.exe must be installed
 17:  *              as a foreign command to allow passing command-line arguments.)
 18:  *
 19:  * Arguments:
 20:  *              date-of-last-update (I) Six chars in the form YYMMDD indicating
 21:  *                                      the last Phoenix update.
 22:  *              flow-control (I)        YY/NN,etc for validation/navigation.
 23:  *
 24:  * Returns:
 25:  *              - none
 26:  *
 27:  * Note:        $define task "vodka""arcscomm phopenix""::""task=arcssrvr"""
 28:  *              before running arcsupdt.  You may replace vodka with star1
 29:  *              if a local copy of the ARCS database route_mst has been copied
 30:  *              from magtape.  But in this case the logical route_mst must
 31:  *              also be defined (pointing to the ARCS database).
 32:  *
 33:  * Source:      ARCSUPDT.C
 34:  *
 35:  * --------------------------------------------------------------------------
 36:  * Revision History:
 37:  *
 38:  * 12/30/85     J.Forkosh       Installation.
 39:  *
 40:  ****************************************************************************/
 41: 
 42: #include stdio
 43: #include rms
 44: #include "arcscomm.h"
 45: #include "pdata.h"
 46: #include "phnxstat.h"
 47: #define MSGLEVEL 99
 48: #define MAX_ERRS 3
 49: #define RPTFILE  "ARCSUPDT.RPT"
 50: #define DUPFILE  "ARCSUPDT.DUP"
 51: 
 52: /* ---------------------------------------------------------------------------
 53:    Global Variables
 54: --------------------------------------------------------------------------- */
 55: globaldef int   msglevel = MSGLEVEL;            /* message level for debug */
 56: globaldef char  dummy_rec[512];                 /* phnxclnt test msgs kludge */
 57: 
 58: main( argc, argv )
 59: int     argc;
 60: char    *argv[];
 61: {
 62: 
 63: /* ---------------------------------------------------------------------------
 64:    Allocations and Declarations
 65: --------------------------------------------------------------------------- */
 66: char    dup[64];                                /* last update = *argv[1] */
 67: char    dup_key[64];                            /* dup from retrieved record */
 68: char    gcn_key[64];                            /* gcn from retrieved record */
 69: char    flow_control[64];                       /* YY/NN,etc = *argv[2] */
 70: int     validate, navigate;                     /* user flow control flags */
 71: static  char rptfile[64] = RPTFILE;             /* RMS file for audit report */
 72: static  char dupfile[64] = DUPFILE;             /* RMS file for dup date */
 73: FILE    *rptptr,*dupptr,*fopen();               /* ptrs to rpt and dup files */
 74: char    request[64];                            /* buffer for ARCS request */
 75: char    command[64];                            /* validation command return */
 76: union   {
 77:         char    clnt_reply[512];                /* char buffer for reply */
 78:         struct  arcscomm_buf phx_reply;         /* struct buffer for reply */
 79:         } reply;
 80: struct  process_data pdata;                     /* DBSA process data struct */
 81: char    dbsa_data[256];                         /* DBSA input, generic */
 82: int     reply_len;                              /* #chars returned in reply */
 83: int     err_count;                              /* accumulated error count */
 84: int     nupdates;                               /* number of updates done */
 85: int     prfflds[32];                            /* fields requiring update */
 86: int     nprf;                                   /* #fields requiring update */
 87: int     rms_stat,arcs_stat,phnx_stat;           /* various return statuses */
 88: 
 89: /* ---------------------------------------------------------------------------
 90:    Get command-line arguments
 91: --------------------------------------------------------------------------- */
 92: /* --- Date of Last Update is 1st command line arg --- */
 93: if ( argc > 1 )
 94:         {
 95:         strcpy ( dup, argv[1] );                /* local copy of *argv[1] */
 96:         /* we may want to validate YYMMDD format of dup */
 97:         }
 98: else
 99:         {                                       /* exit if dup not supplied */
100:         if ( msglevel > 0 )
101:                 printf("\nARCSupdt> Date of Last Update must be specified.");
102:         exit (-1);
103:         }
104: 
105: /* --- Flow Control flags are 2nd command line arg --- */
106: validate = navigate = FALSE;                    /* default no flow control */
107: msglevel = 1;                                   /* be quiet unless 2nd arg */
108: if ( argc > 2 )
109:         {
110:         msglevel = MSGLEVEL;                    /* use defined default */
111:         strcpy ( flow_control, argv[2] );       /* copy 2nd arg if present */
112:         if( flow_control[0] == 'Y' )
113:                 validate = TRUE;                /* user wants to validate */
114:         if( flow_control[1] == 'Y' )            /* user wants to navigate */
115:                 {
116:                 validate = navigate = TRUE;     /* shoot the works */
117:                 if(msglevel<99) msglevel = 99;  /* tell all to user */
118:                 }
119:         }
120: 
121: /* ---------------------------------------------------------------------------
122:    Initialization
123: --------------------------------------------------------------------------- */
124: /* --- open the report and date-of-last-update files --- */
125: if( (rptptr=fopen(rptfile,"w")) == NULL )       /* open rptfile for writing */
126:         {                                       /* couldn't do it ... */
127:         if ( msglevel > 0 )                     /* so print err msg, */
128:                 printf("\nARCSupdt> Can't open() report file.");
129:         exit (-1);
130:         }
131: if ( navigate )
132:         dupptr = NULL;                          /* can't dup if navigating */
133: else
134:         {
135:         if( (dupptr=fopen(dupfile,"w")) == NULL )/* open dupfile for writing */
136:                 {                               /* couldn't do it ... */
137:                 if ( msglevel > 0 )             /* so print err msg, */
138:                         printf("\nARCSupdt> Can't open() dup file.");
139:                 exit (-1);
140:                 }
141:         }
142: 
143: /* --- open the DECnet task --- */
144: if( (arcs_stat = arcsclnt("OPEN",&reply.clnt_reply,&reply_len))
145: != RMS$_NORMAL )                                /* try to "open" DECnet */
146:         {                                       /* couldn't do it ... */
147:         if ( msglevel > 0 )                     /* so print err msg, */
148:                 printf("\nARCSupdt> Can't open() TASK file.");
149:         exit (-1);
150:         }
151: 
152: /* --- INIT the Phoenix DBSA --- */
153: if ( (phnx_stat = phnxclnt("INIT","ARCScomm",&pdata))
154: != PHNX$_SUCCESS )                              /* try to init DBSA process */
155:         {                                       /* couldn't do it ... */
156:         if ( msglevel > 0 )                     /* so print err msg, */
157:                 printf("\nARCSupdt> Can't INIT Phoenix DBSA.");
158:         arcsclnt("CLOSE",&reply.clnt_reply,&reply_len); /* close DECnet link */
159:         exit (-1);                              /* and quit */
160:         }
161: 
162: /* --- get ready for first reconciliation --- */
163: strcpy ( request, dup );                        /* 1st request is keyed dup */
164: err_count = 0;                                  /* so far, so good */
165: nupdates = 0;                                   /* nothing done yet */
166: 
167: /* ---------------------------------------------------------------------------
168:    Loop forever, i.e., until EOF from ARCSsrvr partner means no more updates.
169: --------------------------------------------------------------------------- */
170: while (TRUE)
171:         {
172: /* --- debugging mode if msglevel > 9 (same test throughout program) --- */
173:         if ( msglevel > 9 )                     /* debugging audit trail */
174:                 printf("\n\nARCSupdt> request= %.32s", request);
175: 
176: /* ---------------------------------------------------------------------------
177:    Issue request to get next updated ARCS record
178: --------------------------------------------------------------------------- */
179: /* --- Issue request until server returns RMS$_NORMAL --- */
180:         while ( (rms_stat = arcsclnt(request,&reply.clnt_reply,&reply_len))
181:         != RMS$_NORMAL )                        /* issue request until ok */
182:                 {
183:                 if ( msglevel > 1 )             /* print err message if not */
184:                         printf("\nARCSupdt> ARCSclnt returned %s",
185:                         vmsmsg(rms_stat));
186:                 if ( ++err_count > MAX_ERRS )   /* abort if too many errs */
187:                         goto end_of_job;
188:                 }
189:         if ( msglevel > 9 )                     /* print reply when ok */
190:                 printf("\nARCSupdt> reply= %.56s", reply.clnt_reply);
191:         strncpy(dummy_rec,reply.clnt_reply,reply_len);  /* for testing */
192: 
193: /* --- check for ARCSsrvr ERR message --- */
194:         if ( !strncmp(reply.clnt_reply,"***ERR***",9) )
195:                 {                               /* got an ERR msg ... */
196:                 if ( msglevel > 1 )             /* print it ??? */
197:                         printf("\nARCSupdt> ARCSclnt ERR for request=%.32s",
198:                         request);
199:                 if ( ++err_count > MAX_ERRS )   /* ***ERR*** handler */
200:                         goto end_of_job;        /* abort if too many errs, */
201:                 else    goto next_request;      /* don't retry same request */
202:                 }
203: 
204: /* --- check for ARCSsrvr EOF message --- */
205:         if ( !strncmp(reply.clnt_reply,"***END***",9) )
206:                 {                               /* got an EOF msg ... */
207:                 if ( navigate )                 /* if user issued request */
208:                         goto next_request;      /* let him issue another */
209:                 else    break;                  /* else fall through loop */
210:                 }
211: 
212: /* ---------------------------------------------------------------------------
213:    Retrieve corresponding Phoenix customer-file record
214: --------------------------------------------------------------------------- */
215: /* --- Extract key from ARCSsrvr message --- */
216: strncpy( dup_key, &reply.clnt_reply[DUPPOS], DUPLEN ); /* copy dup from msg */
217: dup_key[DUPLEN] = '\0';                         /* must be NULL terminated */
218: strncpy( gcn_key, &reply.clnt_reply[GCNPOS], GCNLEN ); /* copy gcn from msg */
219: gcn_key[GCNLEN] = '\0';                         /* must be NULL terminated */
220: 
221: /* --- Issue request to Phoenix DBSA to read cust with same GCN as ARCS --- */
222:         if ( (phnx_stat = phnxclnt("RDCUST",gcn_key,&pdata))
223:         != PHNX$_SUCCESS )                      /* try to read DBSA cust rec */
224:                 {                               /* couldn't do it ... */
225:                 if ( phnx_stat == PHNX$_NOTFOUND )
226:                         {                       /* new customer */
227:                         nprf = 0;               /* default it for validate */
228:                         goto validate_update;   /* let user check it out */
229:                         }
230:                 if ( msglevel > 0 )             /* something else, print err */
231:                         printf("\nARCSupdt> Can't READ_CUST=%.5s",
232:                         reply.phx_reply.gcn);
233:                 if ( phnx_stat != PHNX$_FATALERR )
234:                         {                       /* if it's not fatal ... */
235:                         if ( ++err_count > MAX_ERRS )
236:                                 goto end_of_job;/* abort if too many errs */
237:                         else
238:                                 goto next_request;/* else try again */
239:                         }
240:                 else
241:                         goto end_of_job;        /* else it is fatal, so quit */
242:                 }
243: 
244: /* ---------------------------------------------------------------------------
245:    Perform reconciliation, and check with user if update required 
246: --------------------------------------------------------------------------- */
247: /* --- arcsproof returns nprf,prfflds indicating fields not proofing --- */
248: reconcile:
249:         if ( (nprf = arcsproof("COMP",&reply.clnt_reply,&pdata,&prfflds))
250:         == 0 )  goto next_request;              /* reconciled ok */
251:         if ( msglevel > 9 )
252:                 printf("\nARCSupdt> #unreconciled fields=%d", nprf);
253: 
254: /* --- check with user if validating updates --- */
255: validate_update:
256:         if ( validate )
257:                 {
258:                 arcsvalid("VALID",&reply.clnt_reply,&pdata,
259:                 nprf,&prfflds,&command);
260:                 if ( !strcmp(command,"NG") )
261:                         {                       /* must stop logging dup */
262:                         if ( dupptr!=NULL )     /* if we were logging */
263:                                 {
264:                                 fclose(dupptr); /* close the dup file */
265:                                 dupptr = NULL;  /* trash the pointer */
266:                                 }
267:                         goto next_request;
268:                         }
269:                 if ( !strcmp(command,"BY") ) goto end_of_job;
270:                 if ( !strcmp(command,"GO") ) validate = FALSE;
271:                 }
272: 
273: /* ---------------------------------------------------------------------------
274:    Write initial customer or update existing record, and log it to audit trail.
275: --------------------------------------------------------------------------- */
276: /* --- log to audit trail and report (log first, before changing pdata) --- */
277:         if ( rptptr!=NULL )
278:                 arcsrpt(rptptr,&reply.clnt_reply,&pdata,nprf,&prfflds);
279: 
280: /* --- write updated record --- */
281:         if ( phnx_stat == PHNX$_NOTFOUND )      /* either write initial cust */
282:                 {                               /* record */
283:                 arcsproof("INIT",&reply.clnt_reply,&pdata,&prfflds);
284:                 phnx_stat = phnxclnt("WRCUST",&reply.phx_reply.gcn,&pdata);
285:                 }
286:         else                                    /* or update existing cust */
287:                 {
288:                 arcsproof("COPY",&reply.clnt_reply,&pdata,&prfflds);
289:                 phnx_stat = phnxclnt("UPCUST",&reply.phx_reply.gcn,&pdata);
290:                 }
291:         if (phnx_stat == PHNX$_SUCCESS )        /* check for success */
292:                 nupdates++;                     /* ok-increment update count */
293:         else                                    /* ng- ... */
294:                 {
295:                 if ( ++err_count > MAX_ERRS )
296:                         goto end_of_job;        /* abort if too many errs */
297:                 }
298: 
299: /* ---------------------------------------------------------------------------
300:    Check if user is manually navigating, request "NEXT" if not.
301: --------------------------------------------------------------------------- */
302: next_request:
303:         strcpy ( request, "NEXT" );             /* default if not navigating */
304:         if ( navigate )                         /* but if navigating ... */
305:                 {
306:                 printf("\n\nARCSupdt> Enter Request -->");    /* prompt user */
307:                 gets(request);                  /* see what he wants */
308:                 if ( !strcmp(request,"BYE") || !strcmp(request,"bye") )
309:                         goto end_of_job;        /* bye means bye */
310:                 if ( !strcmp(request,"DUMP") || !strcmp(request,"dump") )
311:                         {
312:                         arcsvalid("DUMP",&reply.clnt_reply,&pdata,
313:                         nprf,&prfflds,&command);
314:                         if ( !strcmp(command,"BY") ) goto end_of_job;
315:                         if ( !strcmp(command,"GO") )
316:                                 {
317:                                 navigate = FALSE;
318:                                 msglevel = 1;
319:                                 }
320:                         goto next_request;
321:                         }
322:                 if ( strlen(request) == 0 )
323:                         strcpy(request,"NEXT"); /* null means next */
324:                 err_count = 0;                  /* more lenient navigating */
325:                 }
326:         else
327:                 {                               /* only if not navigating - */
328:                 if ( dupptr != NULL )           /* see if dupfile still open */
329:                         fprintf(dupptr,"%s\n",dup_key); /* write last dup */
330:                 }
331: 
332:         }       /* --- End of main while loop --- */
333: 
334: /* ---------------------------------------------------------------------------
335:    End of job
336: --------------------------------------------------------------------------- */
337: end_of_job:
338: phnxclnt("SHUTDN",&dbsa_data,&pdata);           /* shut down the DBSA */
339: arcsclnt("CLOSE",&reply.clnt_reply,&reply_len); /* "close" the DECnet link */
340: if ( rptptr!=NULL )
341:         {
342:         arcsrpt(rptptr,NULL,NULL,-1,NULL);      /* -1 arg for final footer */
343:         fclose(rptptr);                         /* close the report file */
344:         }
345: if ( dupptr!=NULL )
346:         fclose(dupptr);                         /* close the dup file */
347: if ( msglevel > 9 )
348:         printf("\n\nHave a nice day.");         /* aloha */
349: exit ( -1 );                                    /* return to VMS */
350: }


     AA    RRRRRRRR     CCCCCCC    SSSSSSS  UUUU  UUUU PPPPPPPP   DDDDDDDD   TTTTTTTTTT
    AAAA   RRRRRRRRR   CCCCCCCCC  SSSSSSSSS UUUU  UUUU PPPPPPPPP  DDDDDDDDD  TTTTTTTTTT
   AA  AA   RR     RR CC      CC SS          UU    UU   PP     PP  DD     DD TT  TT  TT
  AA    AA  RRRRRRRR  CC          SSSSSSS    UU    UU   PPPPPPPP   DD     DD     TT    
 AAAAAAAAA  RRRRRRR   CC           SSSSSSS   UU    UU   PPPPPPP    DD     DD     TT    
AAAAAAAAAA  RR   RR   CC      CC         SS  UU    UU   PP         DD     DD     TT    
AA      AA  RR    RR   CCCCCCCCC SSSSSSSSS    UUUUUU   PPPP       DDDDDDDDD     TTTT   
AA      AA  RR     RR   CCCCCCC   SSSSSSS      UUUU    PPPP       DDDDDDDD      TTTT   

  1: $  ON CONTROL_Y THEN GOTO ABORT         ! set captive session at once.
  2: $! ****************************************************************************
  3: $! *
  4: $! * Copyright (c) 1985, John Forkosh Associates, Inc.  All rights reserved.
  5: $! * --------------------------------------------------------------------------
  6: $! *
  7: $! * PROCEDURE: arcsupdt.com
  8: $! *
  9: $! * PURPOSE:   Front-end DCL shell to drive ARCScomm/Phoenix functions.
 10: $! *            Establishes captive session with user and diaplays menus
 11: $! *            to determine desired function.
 12: $! *
 13: $! * CALL:      @ARCSUPDT type-of-user
 14: $! *
 15: $! * ARGUMENTS:
 16: $! *            type-of-user (I)        Must be either "DBSA" or "PHNX" or
 17: $! *                                    "ARCS".  DBSA users do updates and
 18: $! *                                    print reports.  ARCS/PHNX operators
 19: $! *                                    do tape backup/restore, respectively.
 20: $! *
 21: $! * SOURCE:    ARCSUPDT.COM
 22: $! *
 23: $! * --------------------------------------------------------------------------
 24: $! * Revision History:
 25: $! * 01/03/86 J.Forkosh         Installation.
 26: $! *
 27: $! ****************************************************************************
 28: $  goto INITIALIZATION
 29: $!
 30: $! ----------------------------------------------------------------------------
 31: $  ABORT:
 32: $! ----------------------------------------------------------------------------
 33: $! --- TRAP FOR < Ctrl-Y > AS WELL AS NORMAL EXIT ---
 34: $  write sys$output ff                  ! clear the screen,
 35: $  exit                                 ! and return to caller.
 36: $!
 37: $! ----------------------------------------------------------------------------
 38: $  INITIALIZATION:
 39: $! ----------------------------------------------------------------------------
 40: $  user = P1                            ! type-of-user input argument
 41: $  tape_flag = "TEST"                   ! must be "TRUE" to do backup/restore
 42: $  pr_cmd := "print/que=txb0:"          ! this is the way we print reports
 43: $  message = ""                         ! error/info msg, normally null
 44: $  tape_mounts = 0                      ! check if user wants more than 1
 45: $  arcs = "CCA$DEV:[ARCS.DEVELOP.DATA]" ! path to ARCS database on ARCS machine
 46: $  phnx = "CCA$DEV:[ARCS.DEVELOP.DATA]" ! path to ARCS database on Phoenix
 47: $  home = "CCA$DEV:''f$directory()'"    ! path to ARCScomm programs on Phoenix
 48: $  blanks = "                                                                 "
 49: $  ff = " [0;0H [2J"            ! form-feed for ANSI or hardcopy device
 50: $  if f$getdvi("sys$output","DEVTYPE") .lt. 64 then ff = " "
 51: $!
 52: $! ----------------------------------------------------------------------------
 53: $  MAIN_MENU:                           ! display main menu for type-of-user
 54: $! ----------------------------------------------------------------------------
 55: $! --- DISPLAY HEADER LINE COMMON TO ALL TYPES-OF-USERS ---
 56: $  write sys$output ff,"     TERMINAL: ''f$logical("sys$command")'",-
 57:    "''f$extract(0,34,blanks)'''f$extract(0,20,f$time())'"
 58: $!
 59: $! --- CHECK TYPE-OF-USER ARG IN P1 ---
 60: $  if user .eqs. "PHNX" then goto phnx_oper     ! Phoenix oper-tape loads only
 61: $  if user .eqs. "ARCS" then goto arcs_oper     ! ARCS oper-tape backups only
 62: $  if user .nes. "DBSA" then goto ABORT         ! three strikes and you're out
 63: $!
 64: $! ----------------------------------------------------------------------------
 65: $  dbsa_user:                           ! got a DBSA user - update/report menu
 66: $! ----------------------------------------------------------------------------
 67: $! --- DISPLAY THE DBSA MAIN MENU ---
 68: $!       1         2         3         4         5         6         7
 69: $! 4567890123456789012345678901234567890123456789012345678901234567890123456789
 70: $  type sys$input                       ! DBSA-user main menu follows...
 71:                          ARCSCOMM/PHOENIX MAIN MENU
 72:      -----------------------------------------------------------------------
 73: 
 74:      DATABASE UPDATES                      REPORTS
 75:      ----------------                      -------
 76:      UA - UPDATE USING DECNET TO READ      UR - PRINT UPDATE REPORT
 77:           ARCS DATABASE DIRECTLY
 78:      UP - UPDATE USING PHOENIX COPY OF
 79:           ARCS DATABASE
 80: 
 81:      CONTROL
 82:      -------
 83:      LO - LOGOFF (RETURN TO PHOENIX SYSTEM CONTROL)
 84: 
 85: 
 86: 
 87: 
 88: 
 89: 
 90: $! end-of-file
 91: $  write sys$output message             ! display any residual message  
 92: $  message = ""                         ! reset message
 93: $!
 94: $! --- SEE WHAT USER WANTS ---
 95: $  inquire/nopunc command "     COMMAND: "      ! get a new command and
 96: $  if command .eqs. "LO" then goto ABORT        ! branch accordingly...
 97: $  if command .eqs. "UA" then goto ARCS_UPDT    ! "
 98: $  if command .eqs. "UP" then goto PHNX_UPDT    ! "
 99: $  if command .eqs. "UR" then goto UPDT_RPT     ! "
100: $  message = "     PLEASE ENTER A TWO-CHARACTER COMMAND FROM THE LIST ABOVE..."
101: $  goto MAIN_MENU                       ! oops-user entered garbage
102: $!
103: $! ----------------------------------------------------------------------------
104: $  phnx_oper:                           ! got a phoenix oper-tape loads only
105: $! ----------------------------------------------------------------------------
106: $! --- DISPLY THE PHOENIX OPER MAIN MENU ---
107: $!       1         2         3         4         5         6         7
108: $! 4567890123456789012345678901234567890123456789012345678901234567890123456789
109: $  type sys$input                       ! phoenix-oper main menu follows ...
110:                          ARCSCOMM/PHOENIX MAIN MENU
111:      -----------------------------------------------------------------------
112: 
113:      LOAD TAPE
114:      ---------
115:      LT - LOAD TAPE CONTAINING ARCS DATABASE
116: 
117:      CONTROL
118:      -------
119:      LO - LOGOFF (RETURN TO PHOENIX SYSTEM CONTROL)
120: 
121: 
122: 
123: 
124: 
125: 
126: 
127: 
128: $! end-of-file
129: $  write sys$output message             ! display any residual message
130: $  message = ""                         ! reset message
131: $!
132: $! --- SEE WHAT THE OPER WANTS ---
133: $  inquire/nopunc command "     COMMAND: "      ! see what phoenix-oper wants
134: $  if command .eqs. "LO" then goto ABORT        ! and branch accordingly...
135: $  if command .eqs. "LT" then goto LOAD_TAPE
136: $  message = "     PLEASE ENTER A TWO-CHARACTER COMMAND FROM THE LIST ABOVE..."
137: $  goto MAIN_MENU                       ! oops-phoenix oper gave us garbage
138: $!
139: $! ----------------------------------------------------------------------------
140: $  arcs_oper:                           ! got an ARCS oper-tape backups only
141: $! ----------------------------------------------------------------------------
142: $! --- DISPLY ARCS OPER MAIN MENU ---
143: $!       1         2         3         4         5         6         7
144: $! 4567890123456789012345678901234567890123456789012345678901234567890123456789
145: $  type sys$input                       ! ARCS-oper main menu follows...
146:                          ARCSCOMM/PHOENIX MAIN MENU
147:      -----------------------------------------------------------------------
148: 
149:      BACKUP TAPE
150:      -----------
151:      BT - CREATE A BACKUP TAPE CONTAINING ARCS DATABASE
152: 
153:      CONTROL
154:      -------
155:      LO - LOGOFF (RETURN TO PHOENIX SYSTEM CONTROL)
156: 
157: 
158: 
159: 
160: 
161: 
162: 
163: 
164: $! end-of-file
165: $  write sys$output message             ! display any residual message
166: $  message = ""                         ! reset message
167: $!
168: $! --- SEE WHAT THE OPER WANTS ---
169: $  inquire/nopunc command "     COMMAND: "      ! see what ARCS-oper wants
170: $  if command .eqs. "LO" then goto ABORT        ! and branch accordingly...
171: $  if command .eqs. "BT" then goto BACKUP_TAPE
172: $  message = "     PLEASE ENTER A TWO-CHARACTER COMMAND FROM THE LIST ABOVE..."
173: $  goto MAIN_MENU                       ! oops-ARCS oper gave us garbage
174: $! EJECT 
175: $!
176: $! ----------------------------------------------------------------------------
177: $! ASSIGN APPROPRIATE LOGICALS BEFORE PERFORMING UPDATE
178: $! ----------------------------------------------------------------------------
179: $  ARCS_UPDT:
180: $  if f$logical("route_mst") .nes. "" then deassign route_mst
181: $  if f$logical("city_tbl") .nes. "" then deassign city_tbl
182: $  if f$logical("task") .nes. "" then deassign task
183: $  assign/process 'arcs'route.mst route_mst
184: $  assign/process 'arcs'city.tbl city_tbl
185: $  define task "vodka""arcssrvr arcssrvr""::""task=arcssrvr"""
186: $  goto PERFORM_UPDT
187: $!
188: $  PHNX_UPDT:
189: $  if f$logical("route_mst") .nes. "" then deassign route_mst
190: $  if f$logical("city_tbl") .nes. "" then deassign city_tbl
191: $  if f$logical("task") .nes. "" then deassign task
192: $  assign/process 'phnx'route.mst route_mst
193: $  assign/process 'phnx'city.tbl city_tbl
194: $  define task "vodka""arcssrvr arcssrvr""::""task=arcssrvr"""
195: $  goto PERFORM_UPDT
196: $!
197: $! ----------------------------------------------------------------------------
198: $  PERFORM_UPDT:                        ! got logicals so let's get started...
199: $! ----------------------------------------------------------------------------
200: $! --- FIRST ERASE THE MAIN MENU AND DISPLAY A HEADER ---
201: $  write sys$output ff,"     TERMINAL: ''f$logical("sys$command")'",-
202:    "''f$extract(0,34,blanks)'''f$extract(0,20,f$time())'"
203: $!       1         2         3         4         5         6         7
204: $! 4567890123456789012345678901234567890123456789012345678901234567890123456789
205: $  type sys$input
206:                           ARCSCOMM/PHOENIX UPDATE
207:      -----------------------------------------------------------------------
208: 
209: $! end-of-file
210: $!
211: $! --- CHECK THAT ARCSUPDT.DUP FILE EXISTS BEFORE PROCEEDING ---
212: $  if f$search("''home'arcsupdt.dup") .nes. "" then -   ! check for dup file
213:    goto found_dup                       ! ok-found file with dup record
214: $  type sys$input                       ! uh oh-no dup file/fatal error.
215:      ***********************************************************************
216:      *DATE-OF-LAST-UPDATE NOT AVAILABLE.  CANNOT PERFORM UPDATE.  GET HELP.*
217:      ***********************************************************************
218: 
219: $! end-of-file
220: $  inquire/nopunc reply "     PRESS < RETURN > FOR MAIN MENU: "
221: $  goto MAIN_MENU                       ! force user back to main menu
222: $!
223: $! --- READ LAST DUP DATE FROM LAST LINE OF ARCSUPDT.DUP ---
224: $  found_dup:                           ! ok-we've got a dup file...
225: $  open/read dup_file 'home'arcsupdt.dup! open the dup file for read access
226: $  dup_loop:                            ! read loop
227: $  read/end=last_dup dup_file dup       ! read dup record till eof
228: $  goto dup_loop                        ! still reading??? try again for eof.
229: $  last_dup:                            ! got an eof-last rec is most recent
230: $  close dup_file                       ! close the dup file, and...
231: $  write sys$output "     Date of Last Update: ''dup'"  ! display dup for user
232: $  if f$logical("arcs_dup") .nes. "" then deassign arcs_dup     ! old logical
233: $  assign/process 'dup' arcs_dup        ! create logical for ARCSupdt program
234: $!
235: $! --- RUN THE UPDATE PROGRAM ---
236: $  set noon                             ! don't let program shoot us down
237: $  arcsupdt := "$''home'arcsupdt.exe"   ! create foreign command to execute it
238: $  arcsupdt "''dup'" "X"                ! and give it dup on command line
239: $  set on                               ! back home so restore "on"
240: $!
241: $! --- PURGE ANY EXTRA ARCSUPDT.DUP FILES CREATED ---
242: $  if f$search("''home'arcsupdt.dup;-1") .nes. "" then -        ! another file?
243:    purge 'home'arcsupdt.dup             ! purge any extra dup files created.
244: $  goto MAIN_MENU                       ! all done.
245: $!
246: $! ----------------------------------------------------------------------------
247: $  UPDT_RPT:
248: $! ----------------------------------------------------------------------------
249: $! --- PRINT UPDATE REPORT - NOT MUCH TO DO HERE, JUST PRINT IT AND GO BACK ---
250: $  pr_cmd 'home'arcsupdt.rpt;0          ! print most recent report
251: $  if f$search("''home'arcsupdt.rpt;-1") .nes. "" then -
252:    purge 'home'arcsupdt.rpt             ! purge any old reports
253: $  goto MAIN_MENU                       ! that's all.
254: $! EJECT 
255: $!
256: $! ----------------------------------------------------------------------------
257: $  LOAD_TAPE:                           ! restore a copy of ARCS data on Phnx
258: $! ----------------------------------------------------------------------------
259: $! --- FIRST CHECK INTERNAL FLAG TO MAKE SURE WE CAN HANDLE TAPE ---
260: $  message = "     SORRY, TAPE LOADS CANNOT BE PERFORMED AT THIS TIME."
261: $  if tape_flag .eqs. "FALSE" then goto MAIN_MENU       ! force oper to menu
262: $  message = ""                         ! false alarm, reset message
263: $  if tape_mounts .gt. 0 then -
264: $  message = "     *** NOTE *** YOU HAVE ALREADY LOADED A TAPE"
265: $!
266: $! --- ERASE MAIN MENU AND DISPLAY TAPE LOAD HEADER ---
267: $  load_msg:
268: $  write sys$output ff,"     TERMINAL: ''f$logical("sys$command")'",-
269:    "''f$extract(0,34,blanks)'''f$extract(0,20,f$time())'"
270: $!       1         2         3         4         5         6         7
271: $! 4567890123456789012345678901234567890123456789012345678901234567890123456789
272: $  type sys$input
273:                          ARCSCOMM/PHOENIX LOAD TAPE
274:      -----------------------------------------------------------------------
275: 
276:      ***********************************************************************
277:      *TO PROCEED YOU MUST HAVE A MAGNETIC TAPE CONTAINING THE ARCS DATABASE*
278:      ***********************************************************************
279: 
280: $! end-of-file
281: $  write sys$output message             ! display any residual message
282: $  message = ""                         ! reset message
283: $!
284: $! --- DOUBLE-CHECK THAT OPER WANTS TAPE LOAD AND PROMPT HIM TO MOUNT TAPE ---
285: $  inquire/nopunc reply "     DO YOU WANT TO PROCEED (ENTER Y OR N): "
286: $  if reply .eqs. "N" then goto MAIN_MENU       ! oper decided against it
287: $  message = "     PLEASE ENTER Y FOR YES OR N FOR NO..."
288: $  if reply .nes. "Y" then goto load_msg        ! oper didn't decide
289: $  message = ""
290: $  inquire/nopunc reply "     MOUNT THE TAPE AND PRESS < RETURN > WHEN READY: "
291: $!
292: $! --- ALL SET - MOUNT THE TAPE AND RUN THE BACKUP PROGRAM ---
293: $  if tape_flag .eqs. "TRUE" then -     ! final check on internal tape flag
294:    mount/foreign msa0:                  ! ask VMS for tape mount
295: $  tape_mounts = tape_mounts + 1
296: $  set default 'phnx'                   ! go to database directory
297: $  write sys$output "Now in ''f$directory()'"
298: $  if tape_flag .eqs. "TRUE" then -     ! check internal flag and
299:    backup msa0:arcs.sav/rewind 'phnx'   ! do the backup
300: $  set default 'home'                   ! come back to ARCScomm directory
301: $  write sys$output "Now in ''f$directory()'"
302: $!
303: $! --- ALL DONE - FREEZE THE SCREEN FOR A MOMENT AND GO HOME ---
304: $  inquire/nopunc reply "     TAPE LOAD DONE.  PRESS < RETURN > TO CONTINUE: "
305: $  goto MAIN_MENU                       ! back to main menu for next selection
306: $! EJECT 
307: $!
308: $! ----------------------------------------------------------------------------
309: $  BACKUP_TAPE:                         ! restore ARCS database tape on Phoenix
310: $! ----------------------------------------------------------------------------
311: $! --- FIRST CHECK INTERNAL FLAG TO MAKE SURE WE CAN HANDLE TAPE ---
312: $  message = "     SORRY, TAPE BACKUPS CANNOT BE PERFORMED AT THIS TIME."
313: $  if tape_flag .eqs. "FALSE" then goto MAIN_MENU       ! force oper to menu
314: $  message = ""                         ! false alarm, reset message
315: $  if tape_mounts .gt. 0 then -
316: $  message = "     *** NOTE *** YOU HAVE ALREADY BACKED UP A TAPE"
317: $!
318: $! --- ERASE MAIN MENU AND DISPLAY TAPE BACKUP HEADER ---
319: $  backup_msg:
320: $  write sys$output ff,"     TERMINAL: ''f$logical("sys$command")'",-
321:    "''f$extract(0,34,blanks)'''f$extract(0,20,f$time())'"
322: $!       1         2         3         4         5         6         7
323: $! 4567890123456789012345678901234567890123456789012345678901234567890123456789
324: $  type sys$input
325:                         ARCSCOMM/PHOENIX BACKUP TAPE
326:      -----------------------------------------------------------------------
327: 
328:      **********************************************************************
329:      *TO PROCEED YOU MUST HAVE A MAGNETIC TAPE TO BACKUP THE ARCS DATABASE*
330:      **********************************************************************
331: 
332: $! end-of-file
333: $  write sys$output message             ! display any residual message
334: $  message = ""                         ! reset message
335: $!
336: $! --- DOUBLE-CHECK THAT OPER WANTS BACKUP AND PROMPT HIM TO MOUNT TAPE ---
337: $  inquire/nopunc reply "     DO YOU WANT TO PROCEED (ENTER Y OR N): "
338: $  if reply .eqs. "N" then goto MAIN_MENU       ! oper decided against it
339: $  message = "     PLEASE ENTER Y FOR YES OR N FOR NO..."
340: $  if reply .nes. "Y" then goto backup_msg      ! oper didn't decide
341: $  message = ""
342: $  inquire/nopunc reply "     MOUNT THE TAPE AND PRESS < RETURN > WHEN READY: "
343: $!
344: $! --- ALL SET - MOUNT THE TAPE AND RUN THE BACKUP PROGRAM ---
345: $  if tape_flag .eqs. "TRUE" then -     ! final check on internal tape flag
346:    mount/foreign msa0:                  ! ask VMS for tape mount
347: $  tape_mounts = tape_mounts + 1
348: $  set default 'arcs'                   ! go to database directory
349: $  write sys$output "Now in ''f$directory()'"
350: $  if tape_flag .eqs. "TRUE" then -
351:    backup 'phnx' msa0:arcs.sav/rewind/init
352: $  set default 'home'                   ! come back to ARCScomm directory
353: $  write sys$output "Now in ''f$directory()'"
354: $!
355: $! --- ALL DONE - FREEZE THE SCREEN FOR A MOMENT AND GO HOME ---
356: $  inquire/nopunc reply "     TAPE BACKUP DONE.  PRESS < RETURN > TO CONTINUE: "
357: $  goto MAIN_MENU                       ! back to main menu for next selection
358: $!
359: $! =============================== End-of-File ================================


     AA    RRRRRRRR     CCCCCCC    SSSSSSS  VV      VV      AA    LLLLL        IIIIII  
    AAAA   RRRRRRRRR   CCCCCCCCC  SSSSSSSSS VV      VV     AAAA   LLLLL        IIIIII  
   AA  AA   RR     RR CC      CC SS         VV      VV    AA  AA   LL            II    
  AA    AA  RRRRRRRR  CC          SSSSSSS   VV      VV   AA    AA  LL            II    
 AAAAAAAAA  RRRRRRR   CC           SSSSSSS   VV    VV   AAAAAAAAA  LL            II    
AAAAAAAAAA  RR   RR   CC      CC         SS   VV  VV   AAAAAAAAAA  LL     LL     II    
AA      AA  RR    RR   CCCCCCCCC SSSSSSSSS     VVVV    AA      AA LLLLLLLLLL   IIIIII  
AA      AA  RR     RR   CCCCCCC   SSSSSSS       VV     AA      AA LLLLLLLLLL   IIIIII  

  1: /****************************************************************************
  2:  *
  3:  * Copyright (c) 1985, John Forkosh Associates, Inc.  All rights reserved.
  4:  * --------------------------------------------------------------------------
  5:  *
  6:  * Function:    ARCSvalid
  7:  *
  8:  * Purpose:     Display validation screen and prompt user for command.
  9:  *
 10:  * Call:        arcsvalid ( opcode, arcsmsg, pdata, nprf, prfflds, reply )
 11:  *
 12:  * Arguments:
 13:  *              opcode (I)      addr of char string containing either "VALID"
 14:  *                              to perform normal validation, or "DUMP" to
 15:  *                              dump both ARCS and Phoenix records on screen.
 16:  *              arcsmsg (I)     addr of char string containing ARCS message.
 17:  *              pdata (I)       addr of process data struct containing
 18:  *                              static and dynamic cust-data to be
 19:  *                              reconciled.
 20:  *              nprflds (I)     int containing number of prfflds below, if
 21:  *                              nprflds=0 indicates initial customer record.
 22:  *              prfflds (I)     addr of int vector containing the sequence
 23:  *                              number (1=gcn,etc) of fields not agreeing.
 24:  *              reply (O)       addr of char string returning user command.
 25:  *
 26:  * Returns:     - int
 27:  *              icmd            index of user command within internal table.
 28:  *
 29:  * Source:      ARCSVALID.C
 30:  *
 31:  * --------------------------------------------------------------------------
 32:  * Revision History:
 33:  *
 34:  * 01/06/86     J.Forkosh       Installation.
 35:  *
 36:  ****************************************************************************/
 37: 
 38: #include stdio
 39: #include ctype
 40: #include "arcscomm.h"
 41: #include "pdata.h"
 42: 
 43: /* ---------------------------------------------------------------------------
 44:    Global Variables
 45: --------------------------------------------------------------------------- */
 46: globalref int   msglevel;                       /* debugging message level */
 47: 
 48: arcsvalid ( opcode, arcsmsg, pdata, nprflds, prfflds, reply )
 49: char    *opcode;
 50: char    *arcsmsg;
 51: struct  process_data *pdata;
 52: int     nprflds;
 53: int     *prfflds;
 54: char    *reply;
 55: {
 56: 
 57: /* ---------------------------------------------------------------------------
 58:    Allocations and Declarations
 59: --------------------------------------------------------------------------- */
 60: int     ifld,ifld1,nfld;                        /* index over nprf */
 61: int     iprf,nprf;                              /* field number, num fields */
 62: int     nbytes,nmask;                           /* fld_len, fld+mask_len */
 63: int     arcsoff;                                /* arcs_offset */
 64: int     phnxoff;                                /* phnx_offset */
 65: char    *arcsptr,*phnxptr;                      /* char ptrs to arcs & phnx */
 66: char    arcsfld[256],phnxfld[256];              /* local copies of fields */
 67: char    *stub_name;                             /* char ptr to field name */
 68: char    *hdr_ptrs[8];                           /* char ptrs to hdr fields */
 69: static  int nflds_per_pg = 6;                   /* num fields printed per pg */
 70: static  int hdr_flds[] = {0,3,4,-1};            /* GCN,Country,Inst. */
 71: int     ipage,npage;                            /* page # of validation scrn */
 72: int     ihdr;                                   /* index for hdr_lines */
 73: int     icmd;                                   /* index over commands */
 74: char    command[64];                            /* local copy of user reply */
 75: char    errmsg[64];                             /* tell user he goofed */
 76: char    toupper();                              /* convert command to upper */
 77: int     got_command;                            /* TRUE if we got good cmd */
 78: static  char *command_set[] = { "OK","NG","BY","GO","UP","DN","\000" };
 79: 
 80: /* ---------------------------------------------------------------------------
 81:    Screen Layouts
 82: ------------------------------------------------------------------------------
 83:           1         2         3         4         5         6         7
 84: "1234567890123456789012345678901234567890123456789012345678901234567890123456"
 85: --------------------------------------------------------------------------- */
 86: static  char *hdr_fmt =
 87: "\n     ROUTE CODE: %-5.5s  COUNTRY: %-3.3s  NAME: %-.32s\n";
 88: static  char *fld_fmt =
 89: "\n     %-12.12s     %-25.25s    %-25.25s";
 90: static  char *hdr_lines[] =
 91: {
 92: "\033[0;0H\033[2J",
 93: "     -----------------------------------------------------------------------",
 94: "                       ARCSCOMM/PHOENIX UPDATE VALIDATION                   ",
 95: "     -----------------------------------------------------------------------",
 96: "                              --- COMMANDS ---",
 97: "     OK - PERFORM THIS UPDATE               BY - ABORT JOB (NO MORE UPDATES)",
 98: "     NG - DON'T PERFORM THIS UPDATE         GO - CONTINUE WITHOUT VALIDATING",
 99: "     UP - DISPLAY PREVIOUS PAGE             DN - DISPLAY NEXT PAGE          ",
100: "     -----------------------------------------------------------------------",
101: ""
102: };
103: 
104: /* ---------------------------------------------------------------------------
105:    Initialization
106: --------------------------------------------------------------------------- */
107: if ( msglevel > 99 )                            /* level of debugging output */
108:         {
109:         printf("\nARCSvalid> arcs<%.25s> phnx<%.25s>",
110:         arcsmsg,(char *)&(pdata->static_cust_data));
111:         printf("\nPress ENTER to continue -->");
112:         gets(reply);
113:         }
114: ipage = 0;                                      /* start with 1st page */
115: nprf = nprflds;                                 /* usually the same... */
116: if ( !strcmp(opcode,"DUMP") ) nprf=0;           /* ...unless we're doing dump */
117: if ( (nfld=(nprf>0)?nprf:0) == 0)               /* new record or update ? */
118:         while(arcsphnx_flds[nfld].fld_len >= 0) nfld++;
119: npage = (nfld-1)/nflds_per_pg;                  /* max number pages */
120: errmsg[0] = '\000';                             /* so far, so good */
121: command[0]= '\000';                             /* so far, no command */
122: got_command = FALSE;                            /* not got yet */
123: 
124: /* ---------------------------------------------------------------------------
125:    Display Validation Screen
126: --------------------------------------------------------------------------- */
127: while ( !got_command )                          /* user still wants more */
128:         {
129: /* --- print the page header --- */
130:         for ( ihdr=0; strlen(hdr_lines[ihdr])>0; ihdr++ )
131:                 printf("\n%s",hdr_lines[ihdr]); /* print all header lines */
132:         for ( ihdr=0; (iprf=hdr_flds[ihdr]) >= 0; ihdr++ ) /* get hdr flds */
133:                 hdr_ptrs[ihdr] = arcsmsg + arcsphnx_flds[iprf].arcs_offset;
134:         printf(hdr_fmt, hdr_ptrs[0],hdr_ptrs[1],hdr_ptrs[2]);
135:         printf(fld_fmt, "FIELD NAME","ARCS VALUE","PHOENIX VALUE");
136:         printf(fld_fmt, "----------","----------","-------------");
137: 
138: /* ---------------------------------------------------------------------------
139:    Run through unreconciled fields indicated in prfflds for this page
140: --------------------------------------------------------------------------- */
141: /* --- first handle page navigation --- */
142:         if ( !strcmp(command,"DN") )
143:                 if( ++ipage > npage)                    /* DN=next page */
144:                         {                               /* if went past last */
145:                         ipage = 0;                      /* wrap to 1st page */
146:                         strcpy(errmsg,"WRAPPING TO FIRST PAGE");
147:                         }
148:         if ( !strcmp(command,"UP") )
149:                 if( --ipage < 0 )                       /* UP=prev page */
150:                         {                               /* if before 1st pg */
151:                         ipage = npage;                  /* wrap to last page */
152:                         strcpy(errmsg,"WRAPPING TO LAST PAGE");
153:                         }
154: 
155: /* now loop through fields on this page --- */
156:         for ( ifld=ifld1 = ipage*nflds_per_pg;  /* first field on this pg, */
157:                 ifld < nfld && ifld < ifld1+nflds_per_pg; ifld++ ) /* and last */
158:                 {
159:                 if( nprf > 0 )                  /* got an updated cust... */
160:                         iprf = prfflds[ifld];   /* ...so lookup prfflds */
161:                 else                            /* got a new cust... */
162:                         iprf=ifld;              /* ...so shoot the works */
163:                 stub_name=arcsphnx_flds[iprf].fld_name;
164:                 nbytes  = arcsphnx_flds[iprf].fld_len;
165:                 nmask = strlen(arcsphnx_flds[iprf].phnx_mask);
166:                 arcsoff = arcsphnx_flds[iprf].arcs_offset;
167:                 phnxoff = arcsphnx_flds[iprf].phnx_offset;
168:                 arcsptr = arcsmsg + arcsoff;
169:                 if ( phnxoff >= 0 )             /* use static_cust_data */
170:                         phnxptr = (char *)&(pdata->static_cust_data) + phnxoff;
171:                 else                            /* use dynamic_cust_data */
172:                         phnxptr = (char *)&(pdata->dynamic_cust_data)- phnxoff;
173:                 if ( arcsoff >= 0 )
174:                         {                       /* >=0 means a real field */
175:                         strncpy(arcsfld,arcsptr,nbytes);/* local copies... */
176:                         strncpy(phnxfld,phnxptr,nbytes+nmask);
177:                         arcsfld[nbytes] = phnxfld[nbytes+nmask] = '\000';
178:                         }
179:                         else
180:                         {                       /* <0 is a dummy field */
181:                         strcpy(arcsfld,"dummy field");
182:                         phnxfld[0] = '\000';
183:                         }
184:                 if( nprf==0                     /* new cust or dump... */
185:                 &&  strcmp(opcode,"DUMP") )     /* ...not a dump so new cust */
186:                         {
187:                         phnxfld[0]='\000';      /* print blanks except line1 */
188:                         if( ifld==ifld1 )
189:                                 {
190:                                 strcpy(phnxfld,"---NEW CUSTOMER---");
191:                                 if( ipage==0 ) strcat(phnxfld,"\007");
192:                                 }               /* bell on first page too */
193:                         }
194:                 printf(fld_fmt, stub_name,arcsfld,phnxfld);/* print them */
195:                 }
196: 
197: /* --- skip to page bot, print error message (if any) and command prompt --- */
198:         while (ifld++ - ifld1 < nflds_per_pg)
199:                 printf("\n");                   /* skip to bottom of pg */
200:         printf("\n\n     %s\n     COMMAND: ",errmsg); /* print err & prompt */
201: 
202: /* --- read command, < CR > defaults to Page DN, and lookup in table  --- */
203:         gets ( command );                       /* get reply */
204:         if ( strlen(command)==0 )
205:                 strcpy(command,"DN");           /* default < CR > to Page DN */
206:         for ( icmd=0; command[icmd] != NULL; icmd++ )/* convert each char */
207:                 command[icmd] = toupper(command[icmd]);/* to uppercase */
208:         strcpy(errmsg,"\007PLEASE ENTER A VALID TWO-CHARACTER COMMAND");
209:         for ( icmd=0; strlen(command_set[icmd])>0; icmd++ )
210:                 if ( !strcmp(command_set[icmd],command) )
211:                         {
212:                         errmsg[0] = '\000';     /* reset err msg */
213:                         strcpy(reply,command);  /* return uppercase reply */
214:                         if ( icmd < 4 ) got_command = TRUE; /* else UP or DN */
215:                         break;                  /* already found it so break */
216:                         }
217:         }
218: 
219: /* ---------------------------------------------------------------------------
220:    Return to caller
221: --------------------------------------------------------------------------- */
222: return(icmd);
223: }


  CCCCCCC  LLLLL        IIIIII   EEEEEEEEEE NN      NN TTTTTTTTTT              CCCCCCC 
 CCCCCCCCC LLLLL        IIIIII   EEEEEEEEEE NNN     NN TTTTTTTTTT             CCCCCCCCC
CC      CC  LL            II      EE     EE NNNN    NN TT  TT  TT            CC      CC
CC          LL            II      EEEEEE    NN NN   NN     TT       .        CC        
CC          LL            II      EEEEEE    NN   NN NN     TT      ...       CC        
CC      CC  LL     LL     II      EE     EE NN    NNNN     TT     .....      CC      CC
 CCCCCCCCC LLLLLLLLLL   IIIIII   EEEEEEEEEE NN     NNN    TTTT     ...        CCCCCCCCC
  CCCCCCC  LLLLLLLLLL   IIIIII   EEEEEEEEEE NN      NN    TTTT      .          CCCCCCC 

  1: /****************************************************************************
  2:  *
  3:  * Copyright (c) 1985, John Forkosh Associates, Inc.  All rights reserved.
  4:  * --------------------------------------------------------------------------
  5:  *
  6:  * Program:     client
  7:  *
  8:  * Purpose:     Stub Phoenix client task: Prompts user for request,
  9:  *              sends it to server, reads and prints reply.
 10:  *
 11:  * Call:        $ run client
 12:  *
 13:  * Arguments:
 14:  *              - none          all I/O done interactively
 15:  *
 16:  * Returns:
 17:  *              - none
 18:  *
 19:  * Source:      CLIENT.C
 20:  *
 21:  * Note:        $define task "vodka""user passwd""::""task=arcsserve"""
 22:  *              and place arcsserve.com in sys$login before running client.
 23:  *
 24:  * --------------------------------------------------------------------------
 25:  * Revision History:
 26:  *
 27:  * 12/18/85     J.Forkosh       Installation.
 28:  *
 29:  ****************************************************************************/
 30: 
 31: #include stdio
 32: #include descrip
 33: #include ssdef
 34: #include rms
 35: globalref int   seqlib_rms_stat;
 36: 
 37: main( argc, argv )
 38: int     argc;
 39: char    *argv[];
 40: {
 41: 
 42: /* ---------------------------------------------------------------------------
 43:    Allocations and Declarations
 44: --------------------------------------------------------------------------- */
 45: struct FAB      task_fab;                       /* task-to-task fab */
 46: struct RAB      task_rab;                       /* ditto for rab */
 47: char            task_request[256];              /* record buffer for request */
 48: char            task_reply[1024];               /* record buffer for reply */
 49: int             reply_len;                      /* #chars returned by server */
 50: 
 51: /* ---------------------------------------------------------------------------
 52:    Open the task file
 53: --------------------------------------------------------------------------- */
 54: if ( !sopen( "TASK", "u", &task_fab, &task_rab, 512 ) )
 55:         {
 56:         printf("\nClient> Can't open task - %s", vmsmsg(seqlib_rms_stat));
 57:         exit(-1);
 58:         }
 59: 
 60: while ( TRUE )
 61:         {
 62: /* ---------------------------------------------------------------------------
 63:    Prompt user and get request, 'BYE' or 'bye' to terminate
 64: --------------------------------------------------------------------------- */
 65:         printf("\n\nEnter Request -->");
 66:         gets(task_request);
 67:         if ( !strcmp(task_request,"BYE") || !strcmp(task_request,"bye") )
 68:                 goto end_of_job;
 69:         if ( strlen(task_request) == 0 )
 70:                 strcpy ( task_request, "NEXT" );
 71: /* ---------------------------------------------------------------------------
 72:    Write request, read and print reply
 73: --------------------------------------------------------------------------- */
 74:         if ( !swrite(&task_rab, task_request, strlen(task_request)) )
 75:                 {
 76:                 printf("\nClient> Can't write request - %s",
 77:                         vmsmsg(seqlib_rms_stat));
 78:                 goto end_of_job;
 79:                 }
 80:         if ( !(reply_len=sread(&task_rab, task_reply, 512)) )
 81:                 {
 82:                 printf("\nClient> Can't read reply - %s",
 83:                         vmsmsg(seqlib_rms_stat));
 84:                 goto end_of_job;
 85:                 }
 86:         if ( reply_len < 256 ) task_reply[reply_len] = '\0';
 87:         printf("\nServer Reply-->%.64s", task_reply);
 88:         }
 89: 
 90: /* ---------------------------------------------------------------------------
 91:    End of job
 92: --------------------------------------------------------------------------- */
 93: end_of_job:
 94: sclose ( &task_fab );
 95: printf("\n\nHave a nice day.");
 96: }


  CCCCCCC  LLLLL        IIIIII   EEEEEEEEEE NN      NN TTTTTTTTTT VV      VV MM      MM
 CCCCCCCCC LLLLL        IIIIII   EEEEEEEEEE NNN     NN TTTTTTTTTT VV      VV MMM    MMM
CC      CC  LL            II      EE     EE NNNN    NN TT  TT  TT VV      VV MMMM  MMMM
CC          LL            II      EEEEEE    NN NN   NN     TT     VV      VV MM MMMM MM
CC          LL            II      EEEEEE    NN   NN NN     TT      VV    VV  MM  MM  MM
CC      CC  LL     LL     II      EE     EE NN    NNNN     TT       VV  VV   MM      MM
 CCCCCCCCC LLLLLLLLLL   IIIIII   EEEEEEEEEE NN     NNN    TTTT       VVVV    MM      MM
  CCCCCCC  LLLLLLLLLL   IIIIII   EEEEEEEEEE NN      NN    TTTT        VV     MM      MM

  1: /****************************************************************************
  2:  *
  3:  * Copyright (c) 1985, John Forkosh Associates, Inc.  All rights reserved.
  4:  * --------------------------------------------------------------------------
  5:  *
  6:  * Program:     client
  7:  *
  8:  * Purpose:     Demo of transparent task-to-task communication.
  9:  *              Prompts user for request, sends it to server, reads
 10:  *              and prints reply.
 11:  *
 12:  * Call:        $ run client
 13:  *
 14:  * Arguments:
 15:  *              - none          all I/O done interactively
 16:  *
 17:  * Returns:
 18:  *              - none
 19:  *
 20:  * Source:      CLIENT.C
 21:  *
 22:  * Note:        $define task "vodka""user passwd""::""task=server"""
 23:  *              and place server.com in sys$login before running client.
 24:  *
 25:  * --------------------------------------------------------------------------
 26:  * Revision History:
 27:  *
 28:  * 12/18/85     J.Forkosh       Installation.
 29:  *
 30:  ****************************************************************************/
 31: 
 32: #include stdio
 33: 
 34: main( argc, argv )
 35: int     argc;
 36: char    *argv[];
 37: {
 38: 
 39: /* ---------------------------------------------------------------------------
 40:    Allocations and Declarations
 41: --------------------------------------------------------------------------- */
 42: int             task_file;                      /* file descriptor */
 43: char            task_request[256];              /* record buffer for request */
 44: char            task_reply[1024];               /* record buffer for reply */
 45: int             reply_len;                      /* #chars returned by server */
 46: 
 47: /* ---------------------------------------------------------------------------
 48:    Open the task file
 49: --------------------------------------------------------------------------- */
 50: if ((task_file = open("TASK",0002,0777,"mrs=512","shr=upi")) == -1)
 51:         {
 52:         printf("\nClient> Can't open() TASK file.");
 53:         exit(-1);
 54:         }
 55: 
 56: while ( TRUE )
 57:         {
 58: /* ---------------------------------------------------------------------------
 59:    Prompt user and get request, 'BYE' or 'bye' to terminate
 60: --------------------------------------------------------------------------- */
 61:         printf("\n\nEnter Request --> ");
 62:         gets(task_request);
 63:         if ( !strcmp(task_request,"BYE") || !strcmp(task_request,"bye") )
 64:                 goto end_of_job;
 65: /* ---------------------------------------------------------------------------
 66:    Write request, read and print reply
 67: --------------------------------------------------------------------------- */
 68:         if ( strlen(task_request) == 0 )
 69:                 strcpy(task_request,"NEXT");
 70:         if ( write(task_file,task_request,strlen(task_request)) == -1 )
 71:                 {
 72:                 printf("\nClient> Can't write() request.");
 73:                 goto end_of_job;
 74:                 }
 75:         if ( (reply_len=read(task_file,task_reply,512)) == -1 )
 76:                 {
 77:                 printf("\nClient> Can't read() reply");
 78:                 goto end_of_job;
 79:                 }
 80:         printf("\nServer Reply --> %.56s", task_reply);
 81:         }
 82: 
 83: /* ---------------------------------------------------------------------------
 84:    End of job
 85: --------------------------------------------------------------------------- */
 86: end_of_job:
 87: close ( task_file );
 88: printf("\n\nHave a nice day.");
 89: }


PPPPPPPP   DDDDDDDD        AA    TTTTTTTTTT      AA               HHHH  HHHH
PPPPPPPPP  DDDDDDDDD      AAAA   TTTTTTTTTT     AAAA              HHHH  HHHH
 PP     PP  DD     DD    AA  AA  TT  TT  TT    AA  AA              HH    HH 
 PPPPPPPP   DD     DD   AA    AA     TT       AA    AA   .         HHHHHHHH 
 PPPPPPP    DD     DD  AAAAAAAAA     TT      AAAAAAAAA  ...        HHHHHHHH 
 PP         DD     DD AAAAAAAAAA     TT     AAAAAAAAAA .....       HH    HH 
PPPP       DDDDDDDDD  AA      AA    TTTT    AA      AA  ...       HHHH  HHHH
PPPP       DDDDDDDD   AA      AA    TTTT    AA      AA   .        HHHH  HHHH

  1: /****************************************************************************
  2:  *
  3:  * Copyright (c) 1985, John Forkosh Associates, Inc.  All rights reserved.
  4:  * --------------------------------------------------------------------------
  5:  *
  6:  * Structure:   pdata
  7:  *
  8:  * Purpose:     Describes the process_data structure used by the Phoenix
  9:  *              DBSA.  Note that this is a temporary stub, to be replaced
 10:  *              when CICI provides the definitive structure definitions.
 11:  *
 12:  * Source:      PDATA.H
 13:  *
 14:  * ------------------------------------------------------------------------
 15:  * Revision History:
 16:  *
 17:  * 12/27/85     J.Forkosh       Installation.
 18:  *
 19:  ****************************************************************************/
 20: 
 21: /* ------------------------------------------------------------------------
 22:    DBS error codes / return statuses
 23:    received from Steve Wolfe 01/8/86 for testing.
 24: --------------------------------------------------------------------------- */
 25: #define DBSI_EC_SUCCESSFUL_OPERATION    1
 26: #define DBSI_EC_SUCCESSFUL_NO_DATA      3
 27: #define DBSI_EC_INVALID_CUST_KEY_TYPE   100
 28: #define DBSI_EC_CANT_CHANGE_ORIG_TEXT   102
 29: #define DBSI_EC_NO_ACTIVE_TRANS_SESSION 104
 30: #define DBSI_EC_APPLIC_CANCEL_TRAN      106
 31: #define DBSI_EC_REF_MSG_MODIFIED        110
 32: #define DBSI_EC_NO_STAT_BKT_FOR_OPR     112
 33: 
 34: /* ------------------------------------------------------------------------
 35:    Static Customer Data -- fields for simulation DBS Static Customer File
 36:    received from Steve Wolfe 01/8/86 for testing.
 37: --------------------------------------------------------------------------- */
 38: #define SZ_CORR_NAME            72
 39: #define SZ_CITY_NAME            26
 40: #define SZ_CITY_CODE            3
 41: #define SZ_ST_COUNTRY           3
 42: #define SZ_CABLE_ADDR           20
 43: #define SZ_GCN_ADDR             5
 44: #define SZ_IN_ROUTE             5
 45: #define SZ_CALL_SIGN            6
 46: #define SZ_DIAL_ACCESS_TYPE     1
 47: #define SZ_TELEX_NUM            14
 48: #define SZ_ANSBK_NUM            21
 49: #define SZ_DDA_NUM              8
 50: #define SZ_ABA_NUM              9
 51: #define SZ_CURRENCY_CODE        3
 52: #define SZ_VERIFY_MSGS          1
 53: #define SZ_MARTI_YN             1
 54: #define SZ_TWD_ALG_IN           20
 55: #define SZ_TWD_ALG_IM           20
 56: #define SZ_TWD_ALG_OT           20
 57: #define SZ_FOR_DOM_FLAG         1
 58: #define SZ_MISC_FLAGS           3
 59: #define SZ_COMMENT_C            80
 60:                                                 /*---------------------------*/
 61: struct  static_cust_def                         /*L E N G T H            POS */
 62:         {                                       /*---------------------------*/
 63:         unsigned char   dbs_corr_name           [SZ_CORR_NAME];       /*   0 */
 64:         unsigned char   dbs_city_name           [SZ_CITY_NAME];       /*  72 */
 65:         unsigned char   dbs_city_code           [SZ_CITY_CODE];       /*  98 */
 66:         unsigned char   dbs_st_country          [SZ_ST_COUNTRY];      /* 101 */
 67:         unsigned char   dbs_cable_addr          [SZ_CABLE_ADDR];      /* 104 */
 68:         unsigned char   dbs_gcn_addr            [SZ_GCN_ADDR];        /* 124 */
 69:         unsigned char   dbs_in_route            [SZ_IN_ROUTE];        /* 129 */
 70:         unsigned char   dbs_call_sign           [SZ_CALL_SIGN];       /* 134 */
 71:         unsigned char   dbs_dial_access_type1   [SZ_DIAL_ACCESS_TYPE];/* 140 */
 72:         unsigned char   dbs_telex_num1          [SZ_TELEX_NUM];       /* 141 */
 73:         unsigned char   dbs_ansbk_num1          [SZ_ANSBK_NUM];       /* 155 */
 74:         unsigned char   dbs_dial_access_type2   [SZ_DIAL_ACCESS_TYPE];/* 176 */
 75:         unsigned char   dbs_telex_num2          [SZ_TELEX_NUM];       /* 177 */
 76:         unsigned char   dbs_ansbk_num2          [SZ_ANSBK_NUM];       /* 191 */
 77:         unsigned char   dbs_dial_access_type3   [SZ_DIAL_ACCESS_TYPE];/* 212 */
 78:         unsigned char   dbs_telex_num3          [SZ_TELEX_NUM];       /* 213 */
 79:         unsigned char   dbs_ansbk_num3          [SZ_ANSBK_NUM];       /* 227 */
 80:         unsigned char   dbs_dda_num             [SZ_DDA_NUM];         /* 248 */
 81:         unsigned char   dbs_aba_num             [SZ_ABA_NUM];         /* 256 */
 82:         unsigned char   dbs_currency_code       [SZ_CURRENCY_CODE];   /* 265 */
 83:         unsigned char   dbs_verify_msgs         [SZ_VERIFY_MSGS];     /* 268 */
 84:         unsigned char   dbs_marti_yn            [SZ_MARTI_YN];        /* 269 */
 85:         unsigned char   dbs_twd_alg_in          [SZ_TWD_ALG_IN];      /* 270 */
 86:         unsigned char   dbs_twd_alg_im          [SZ_TWD_ALG_IM];      /* 290 */
 87:         unsigned char   dbs_twd_alg_ot          [SZ_TWD_ALG_OT];      /* 310 */
 88:         unsigned char   dbs_for_dom_flag        [SZ_FOR_DOM_FLAG];    /* 330 */
 89:         unsigned char   dbs_misc_flags          [SZ_MISC_FLAGS];      /* 331 */
 90:         unsigned char   dbs_comment_c           [SZ_COMMENT_C]; /*-----* 334 */
 91:         };                                      /* Static Cust Rec Size= 414 */
 92:                                                 /*---------------------------*/
 93: 
 94: /* ------------------------------------------------------------------------
 95:    Dynamic Customer Data -- trash for testing (actually, ROUTE.MST record fmt)
 96: --------------------------------------------------------------------------- */
 97:                                         /* -------------------------------- */
 98: struct  dynamic_cust_def                /* Fld#  Bytes  Description     Key */
 99:         {                               /* -------------------------------- */
100:         unsigned char   rte[ 5];        /*  01  001-005 GCN Address      00 */
101:         unsigned char   typ[ 1];        /*  02    006   Address type     01 */
102:         unsigned char   cty[ 3];        /*  03  007-009 City Code        02 */
103:         unsigned char   cny[ 3];        /*  04  010-012 Country Code     03 */
104:         unsigned char   rgn[ 2];        /*  05  013-014 Region Code      04 */
105:         unsigned char   nm1[72];        /*  06  015-086 Institution      05 */
106:         unsigned char   smn[ 1];        /*  07    087   Single/Mult Name    */
107:         unsigned char   bkw[ 4];        /*  08  088-091 BankWire Code       */
108:         unsigned char   $$1[23];        /*  09  092-114 << available >>     */
109:         unsigned char   ad1[50];        /*  10  115-164 Inst Address 1      */
110:         unsigned char   ad2[50];        /*  11  165-214 Inst Address 2      */
111:         unsigned char   ad3[50];        /*  12  215-264 Inst Address 3      */
112:         unsigned char   nam[20];        /*  13  265-284 User Name           */
113:         unsigned char   phn[10];        /*  14  285-294 User Phone#         */
114:         unsigned char   pwd[21];        /*  15  295-315 User Password       */
115:         unsigned char   csw[ 2];        /*  16  316-317 Switch ID           */
116:         unsigned char   sta[ 3];        /*  17  318-320 Station/Line ID     */
117:         unsigned char   sda[ 5];        /*  18  321-325 2nd Delivery Addr   */
118:         unsigned char   rfl[ 3];        /*  19  326-328 Refile Country Code */
119:         unsigned char   tac[ 3];        /*  20  329-331 Telex Area Code     */
120:         unsigned char   tx1[13];        /*  21  332-344 1st Telex Number    */
121:         unsigned char   ta1[20];        /*  22  345-364 1st Tx Answerback   */
122:         unsigned char   tx2[13];        /*  23  365-377 2nd Telex Number    */
123:         unsigned char   ta2[20];        /*  24  378-397 2nd Tx Answerback   */
124:         unsigned char   tx3[13];        /*  25  398-410 3rd Telex Number    */
125:         unsigned char   ta3[20];        /*  26  411-430 3rd Tx Answerback   */
126:         unsigned char   bid[19];        /*  27  431-449 Bank ID             */
127:         unsigned char   $$2[ 1];        /*  28    450   << available >>     */
128:         unsigned char   chp[ 9];        /*  29  451-459 CHIPS number        */
129:         unsigned char   swf[11];        /*  30  460-470 Swift Address       */
130:         unsigned char   dda[ 8];        /*  31  471-478 DDA Number          */
131:         unsigned char   exp[ 4];        /*  32  479-482 Expense Code        */
132:         unsigned char   bkg[ 2];        /*  33  483-484 Bank Group          */
133:         unsigned char   bkc[ 4];        /*  34  485-488 MARTI Bank Code     */
134:         unsigned char   bix[ 1];        /*  35    489   Bank ID Prefix      */
135:         unsigned char   sts[ 1];        /*  36    490   Status Flag         */
136:         unsigned char   utr[ 1];        /*  37    491   User Test Region    */
137:         unsigned char   cos[ 2];        /*  38  492-493 Class of Service    */
138:         unsigned char   cot[ 1];        /*  39    494   Class of Terminal   */
139:         unsigned char   udi[ 1];        /*  40    495   User Delivery Info  */
140:         unsigned char   tfs[ 1];        /*  41    496   Test Flag - SENDS   */
141:         unsigned char   tfr[ 1];        /*  42    497   Test Flag - RECVS   */
142:         unsigned char   sys[ 2];        /*  43  498-499 System Indicator    */
143:         unsigned char   dir[ 1];        /*  44    500   GCN Directory       */
144:         unsigned char   dcr[ 6];        /*  45  501-506 Date Record Created */
145:         unsigned char   dup[ 6];        /*  46  507-512 Date Record Updated */
146:         };                              /* -------------------------------- */
147: 
148: /* ------------------------------------------------------------------------
149:    DBSA Process Data Structure
150: --------------------------------------------------------------------------- */
151:                                                 /* ------------------------ */
152: struct  process_data                            /* Len Description          */
153:         {                                       /* ------------------------ */
154:         long            process_id;             /*     PID of this process  */
155:         unsigned char   proc_logical_name[32];  /*     process PHOENIX name */
156:         unsigned char   filler_1[128];          /*     filler               */
157:         long            trans_session_status;   /*     running trans status */
158:         unsigned char   filler_2[128];          /*     filler               */
159:         long            dbs_error_code;         /*     last dbs err status  */
160:         unsigned char   filler_3[128];          /*     filler               */
161:         unsigned char   cust_key[21];           /*     "AxxxxxBLANKS..."    */
162:         unsigned char   filler_4[128];          /*     filler               */
163:         struct static_cust_def                  /*                          */
164:                         static_cust_data;       /*     static customer data */
165:         struct dynamic_cust_def                 /*                          */
166:                         dynamic_cust_data;      /*     dynamic customer dat */
167:         unsigned char   filler_5[128];          /*     filler               */
168:         };                                      /* ------------------------ */
169: 
170: /* ============================ End-of-File ============================== */


PPPPPPPP   HHHH  HHHH NN      NN XX      XX   CCCCCCC  LLLLL      NN      NN TTTTTTTTTT
PPPPPPPPP  HHHH  HHHH NNN     NN  XX    XX   CCCCCCCCC LLLLL      NNN     NN TTTTTTTTTT
 PP     PP  HH    HH  NNNN    NN   XX  XX   CC      CC  LL        NNNN    NN TT  TT  TT
 PPPPPPPP   HHHHHHHH  NN NN   NN     XX     CC          LL        NN NN   NN     TT    
 PPPPPPP    HHHHHHHH  NN   NN NN     XX     CC          LL        NN   NN NN     TT    
 PP         HH    HH  NN    NNNN   XX  XX   CC      CC  LL     LL NN    NNNN     TT    
PPPP       HHHH  HHHH NN     NNN  XX    XX   CCCCCCCCC LLLLLLLLLL NN     NNN    TTTT   
PPPP       HHHH  HHHH NN      NN XX      XX   CCCCCCC  LLLLLLLLLL NN      NN    TTTT   

  1: /****************************************************************************
  2:  *
  3:  * Copyright (c) 1985, John Forkosh Associates, Inc.  All rights reserved.
  4:  * --------------------------------------------------------------------------
  5:  *
  6:  * Function:    PHNXclnt
  7:  *
  8:  * Purpose:     Issues request for cust-file record I/O to the Phoenix DBSA.
  9:  *
 10:  * Call:        phnxclnt ( request, parg, pdata )
 11:  *
 12:  * Arguments:
 13:  *              request (I)     addr of char string containing a mnemonic for
 14:  *                              the operation to be performed:
 15:  *                              request(I) parg(I/O*)   operation
 16:  *                              ---------- ----------   ---------
 17:  *                              (1)INIT    proc name    Initialize Process
 18:  *                              (2)BEGIN   < unused >   Begin Transaction
 19:  *                              (3)WRTLOG# applic msg   Write to Generic Log
 20:  *                              (4)COMMIT  < unused >   Commit Transaction
 21:  *                              (5)CANCEL  < unused >   Cancel Transaction
 22:  *                              (6)SHUTDN  shutdn msg*  Shutdown Process
 23:  *                              (7)RDCUST# route code   Read Customer
 24:  *                              (8)WRCUST# route code   Write Initial Customer
 25:  *                              (9)UPCUST# route code   Update Customer
 26:  *                              # BEGIN/COMMIT done within PHNXclnt
 27:  *                              * Output field
 28:  *              parg (I/O)      addr of char string containing argument
 29:  *                              corresponding to above table.  When parg is
 30:  *                              route code, it's the 5-char routing code
 31:  *                              for customer (same as ROUTE_MST gcn code).
 32:  *                              If NULL, pdata cust-key will be left unchanged
 33:  *                              from previous call.
 34:  *              pdata (I/O)     addr of process data struct containing
 35:  *                              cust-data, etc (see pdata.h).  Note that caller
 36:  *                              MUST ALWAYS call phnxclnt with the same pdata
 37:  *                              struct, and MUST NEVER write into it himself.
 38:  *
 39:  * Returns:     - int
 40:  *
 41:  * Source:      PHNXCLNT.C
 42:  *
 43:  * --------------------------------------------------------------------------
 44:  * Revision History:
 45:  *
 46:  * 12/31/85     J.Forkosh       Installation.
 47:  *
 48:  ****************************************************************************/
 49: 
 50: #include stdio
 51: #include "pdata.h"
 52: #include "phnxstat.h"
 53: 
 54: /* ---------------------------------------------------------------------------
 55:    Phoenix DBSA Gateway Interface Functions
 56: --------------------------------------------------------------------------- */
 57: #define INIT    phnx_stub
 58: #define BEGIN   phnx_stub
 59: #define WRTLOG  phnx_stub
 60: #define COMMIT  phnx_stub
 61: #define CANCEL  phnx_stub
 62: #define SHUTDN  phnx_stub
 63: #define RDCUST  test_rdcust
 64: #define WRCUST  phnx_stub
 65: #define UPCUST  phnx_stub
 66: /* ---------------------------------------------------------------------------
 67:    Global Variables
 68: --------------------------------------------------------------------------- */
 69: globalref int   msglevel;                       /* debugging message level */
 70: globalref char  dummy_rec[512];                 /* for testing */
 71: 
 72: phnxclnt ( request, parg, pdata )
 73: char    *request;
 74: char    *parg;
 75: struct  process_data *pdata;
 76: {
 77: 
 78: /* ---------------------------------------------------------------------------
 79:    Allocations and Declarations
 80: --------------------------------------------------------------------------- */
 81: static  char *dbsa_calls[] =                    /* lookup tbl of DBSA calls */
 82:         {                                       /* switch() uses tbl index  */
 83:         "INIT",         "BEGIN",        "WRTLOG",
 84:         "COMMIT",       "CANCEL",       "SHUTDN",
 85:         "RDCUST",       "WRCUST",       "UPCUST",
 86:         "\0"
 87:         };
 88: int     irequest;                               /* indx in tbl match request */
 89: int     dbsa_stat;                              /* return stat from DBSA */
 90: int     phnx_stat;                              /* return stat to caller */
 91: char    cust_key[32];                           /* 21-char cust_key */
 92: 
 93: /* ---------------------------------------------------------------------------
 94:    Initialization
 95: --------------------------------------------------------------------------- */
 96: if ( msglevel > 99 )                            /* level of debugging output */
 97:         printf ("\nPHNXclnt> request= %.32s", request);
 98: phnx_stat = dbsa_stat = PHNX$_SUCCESS;          /* so far, so good */
 99: 
100: /* ---------------------------------------------------------------------------
101:    Determine request type
102: --------------------------------------------------------------------------- */
103: irequest = 0;                                   /* start with 1st call */
104: while ( strlen(dbsa_calls[irequest]) > 0 )      /* trailer is "\0" */
105:         {                                       /* does tbl match request? */
106:         if ( !strcmp(dbsa_calls[irequest],request) ) goto issue_request;
107:         irequest++;                             /* nope - try next call */
108:         }
109: if ( msglevel > 1 )                             /* input arg has bum request */
110:         printf ("\nPHNXclnt> invalid request= %.32s", request);
111: return ( PHNX$_BADARG );
112: 
113: /* ---------------------------------------------------------------------------
114:    Issue request
115: --------------------------------------------------------------------------- */
116: issue_request:
117: dbsa_stat = DBSI_EC_SUCCESSFUL_OPERATION;       /* default DBSA status ok */
118: phnx_stat = PHNX$_SUCCESS;                      /* default Phoenix stat ok */
119: switch ( irequest+1 )
120:         {
121:         case 1:
122:                 INIT    ( parg,  pdata, &dbsa_stat );
123:                 if ( dbsa_stat != DBSI_EC_SUCCESSFUL_OPERATION )
124:                         phnx_stat = PHNX$_FATALERR;     /* can't init fatal */
125:                 break;
126:         case 2:
127:                 BEGIN   ( pdata, pdata );
128:                 break;
129:         case 3:
130:                 BEGIN   ( pdata, pdata );
131:                 WRTLOG  ( pdata, parg,  pdata, &dbsa_stat );
132:                 if ( dbsa_stat == DBSI_EC_SUCCESSFUL_OPERATION )
133:                         COMMIT  ( pdata, pdata, &dbsa_stat );
134:                 else
135:                         {
136:                         phnx_stat = PHNX$_FAILURE;
137:                         CANCEL  ( pdata, pdata, &dbsa_stat );
138:                         }
139:                 break;
140:         case 4:
141:                 COMMIT  ( pdata, pdata, &dbsa_stat );
142:                 break;
143:         case 5:
144:                 CANCEL  ( pdata, pdata, &dbsa_stat );
145:                 break;
146:         case 6:
147:                 SHUTDN  ( pdata, parg,  &dbsa_stat );
148:                 break;
149:         case 7:
150:                 strncpy ( cust_key, "A                       ", 21);
151:                 strncpy ( &cust_key[1], parg, 5 );
152:                 BEGIN   ( pdata, pdata );
153:                 RDCUST  ( pdata, cust_key, pdata, &dbsa_stat );
154:                 if ( dbsa_stat != DBSI_EC_SUCCESSFUL_OPERATION )
155:                         {
156:                         if ( dbsa_stat == DBSI_EC_SUCCESSFUL_NO_DATA )
157:                                 phnx_stat = PHNX$_NOTFOUND;
158:                         else
159:                                 phnx_stat = PHNX$_FAILURE;
160:                         }
161:                 COMMIT  ( pdata, pdata, &dbsa_stat );
162:                 break;
163:         case 8:
164:                 BEGIN   ( pdata, pdata );
165:                 WRCUST  ( pdata, pdata, &dbsa_stat );
166:                 if ( dbsa_stat == DBSI_EC_SUCCESSFUL_OPERATION )
167:                         COMMIT  ( pdata, pdata, &dbsa_stat );
168:                 else
169:                         {
170:                         phnx_stat = PHNX$_FAILURE;
171:                         CANCEL  ( pdata, pdata, &dbsa_stat );
172:                         }
173:                 break;
174:         case 9:
175:                 BEGIN   ( pdata, pdata );
176:                 UPCUST  ( pdata, pdata, &dbsa_stat );
177:                 if ( dbsa_stat == DBSI_EC_SUCCESSFUL_OPERATION )
178:                         COMMIT  ( pdata, pdata, &dbsa_stat );
179:                 else
180:                         {
181:                         phnx_stat = PHNX$_FAILURE;
182:                         CANCEL  ( pdata, pdata, &dbsa_stat );
183:                         }
184:                 break;
185:         default:
186:                 break;
187:         }
188: 
189: /* ---------------------------------------------------------------------------
190:    Return to caller
191: --------------------------------------------------------------------------- */
192: return ( phnx_stat );
193: }
194: 
195: /* ---------------------------------------------------------------------------
196:    Dummy Routines
197: --------------------------------------------------------------------------- */
198: phnx_stub()
199:         {
200:         return;
201:         }
202: 
203: test_rdcust(pdata,arg2,arg3,dbsa_stat)
204: struct  process_data *pdata;
205: int     *arg2,*arg3;
206: int     *dbsa_stat;
207: {
208: char *stat,*dynam;                              /* char ptrs to cust-data */
209: float xrand;    int irand;                      /* random error decision */
210: int  prfflds[32];                               /* dummy for arcsproof */
211: arcsproof ( "INIT",dummy_rec,pdata,prfflds );   /* init pdata */
212: *dbsa_stat = DBSI_EC_SUCCESSFUL_OPERATION;      /* init return stat */
213: stat = (char *)&(pdata->static_cust_data);
214: dynam= (char *)&(pdata->dynamic_cust_data);
215: strncpy(dynam,dummy_rec,276);                   /* init dynam = arcs */
216: xrand = (float)rand()/(float)(2147483647);      /* 0 <= xrand <= 1 */
217: irand = (int)(xrand*276.);                      /* 0 to length of rec */
218: if ( irand < 200 )                              /* about 1 chance in 3 */
219:         {
220:         stat[irand]=dynam[irand]='X';           /* we'll mess up a char */
221:         if(irand<150)
222:         stat[irand+100]=dynam[irand+100]='X';   /* we'll mess up a char */
223:         if(irand<100)
224:         stat[4*irand]=dynam[4*irand]='X';       /* we'll mess up a char */
225:         }
226: if ( irand < 50 )
227:         *dbsa_stat = DBSI_EC_SUCCESSFUL_NO_DATA;/* new rec in this case */
228: if ( msglevel > 9 )
229:         printf("\nPHNXrdcust> arcs<%.25s> phnx<%.25s>",
230:         dummy_rec,(char *)&(pdata->static_cust_data));
231: return;
232: }


PPPPPPPP   HHHH  HHHH NN      NN XX      XX MM      MM   SSSSSSS  TTTTTTTTTT           
PPPPPPPPP  HHHH  HHHH NNN     NN  XX    XX  MMM    MMM  SSSSSSSSS TTTTTTTTTT           
 PP     PP  HH    HH  NNNN    NN   XX  XX   MMMM  MMMM SS         TT  TT  TT           
 PPPPPPPP   HHHHHHHH  NN NN   NN     XX     MM MMMM MM  SSSSSSS       TT       .       
 PPPPPPP    HHHHHHHH  NN   NN NN     XX     MM  MM  MM   SSSSSSS      TT      ...      
 PP         HH    HH  NN    NNNN   XX  XX   MM      MM         SS     TT     .....     
PPPP       HHHH  HHHH NN     NNN  XX    XX  MM      MM SSSSSSSSS     TTTT     ...      
PPPP       HHHH  HHHH NN      NN XX      XX MM      MM  SSSSSSS      TTTT      .       

  1: C/****************************************************************************
  2: C *
  3: C * Copyright (c) 1985, John Forkosh Associates, Inc.  All rights reserved.
  4: C * --------------------------------------------------------------------------
  5: C *
  6: C * Structure:  PHNXMST
  7: C *
  8: C * Purpose:    Describes the structure used to transfer ROUTE_MST records
  9: C *             from the ARCS server to the Phoenix client.
 10: C *
 11: C * Notes:      The Route Master file ROUTE_MST contains one 512-byte
 12: C *             fixed-length record per GCN address.  (It is an indexed file,
 13: C *             with primary key RTERTE and several alternate keys.)  Each
 14: C *
 15: C *             Each ROUTE_MST record maps into a Phoenix buffer, ARCSCOMM_BUF,
 16: C *             as described in this include file:
 17: C *             _P extension refers to a variable's position within RTEBUF,
 18: C *             _L refers to its length in  B*O*T*H  RTEBUF and ARCSCOMM_BUF.
 19: C *
 20: C *             The position within ARCSCOMM_BUF is determined dynamically as
 21: C *             the record is built by successively concatanating specified
 22: C *             fields.
 23: C *
 24: C *             THERE ARE SEVERAL KLUDGES:
 25: C *             _P - Value      Meaning
 26: C *             ----------      -------
 27: C *             -1              Undefined (filled with PHX_FILLER char)
 28: C *             -3              City_Name field (read from CITY.TBL)
 29: C *             -99             OPR field (literal '99')
 30: C *             
 31: C *             Compile this file with /CONTINUATIONS=32 since the
 32: C *             initialization contains more than 19 lines.
 33: C *
 34: C * Source:     PHNXMST.INC
 35: C *
 36: C * --------------------------------------------------------------------------
 37: C * Revision History:
 38: C *
 39: C * 12/27/85    J.Forkosh       Installation.
 40: C *
 41: C ****************************************************************************/
 42: C 
 43:         INTEGER*2       N_PHX_FIELDS /22/       ! # FIELDS IN PHOENIX RECORD
 44:         CHARACTER*1     PHX_FILLER/'?'/         ! FILLER FOR UNDEFINED FIELDS
 45: C
 46:         INTEGER*2 PHX_LAYOUT(2,32)
 47:      +           !-------------------------------------------------------------
 48:      +           !      POSITION        LENGTH          !FLD    DESCRIPTION
 49:      +          /!-------------------------------------------------------------
 50:      +                  RTERTE_P,       RTERTE_L,       !  1    GCN ADDRESS
 51:      +                  RTECTY_P,       RTECTY_L,       !  2    CITY CODE
 52:      +                  -3,             26,             !  3    CITY NAME
 53:      +                  RTECNY_P,       RTECNY_L,       !  4    COUNTRY CODE
 54:      +                  RTENM1_P,       72,!RTENM1_L,   !  5    INSTITUTION NM
 55:      +                  RTEBKW_P,       RTEBKW_L,       !  6    BANKWIRE CODE
 56:      +                  RTETN1_P,       RTETN1_L,       !  7    1ST TELEX #
 57:      +                  RTETA1_P,       RTETA1_L,       !  8    1ST TELEX ANS
 58:      +                  RTETN2_P,       RTETN2_L,       !  9    2ND TELEX #
 59:      +                  RTETA2_P,       RTETA2_L,       ! 10    2ND TELEX ANS
 60:      +                  RTETN3_P,       RTETN3_L,       ! 11    3RD TELEX #
 61:      +                  RTETA3_P,       RTETA3_L,       ! 12    3RD TELEX ANS
 62:      +                  RTEBID_P,       RTEBID_L,       ! 13    BANK ID
 63:      +                  -1,             9,              ! 14    ABA Number
 64:      +                  RTEDDA_P,       RTEDDA_L,       ! 15    DDA NUMBER
 65:      +                  RTEMBC_P,       RTEMBC_L,       ! 16    MARTI CODE
 66:      +                  RTETFS_P,       RTETFS_L,       ! 17    TEST FLAG SEND
 67:      +                  RTEDUP_P,       RTEDUP_L,       ! 18    DATE LAST UPDT
 68:      +                  -99,            2,              ! 19    OPR ID= "99"
 69:      +                  -1,             5,              ! 20    SGM=SYS MSGS
 70:      +                  -1,             5,              ! 21    MCI=MASTER ID
 71:      +                  -1,             5,              ! 22    OVERRIDE ROUTE
 72:      +                  20*-1
 73:      +          /!-------------------------------------------------------------
 74: C
 75:         COMMON/PHX_FORM/ N_PHX_FIELDS, PHX_LAYOUT
 76: C/* =========================== End-of-File ================================ */


PPPPPPPP   HHHH  HHHH NN      NN XX      XX   SSSSSSS  TTTTTTTTTT      AA    TTTTTTTTTT
PPPPPPPPP  HHHH  HHHH NNN     NN  XX    XX   SSSSSSSSS TTTTTTTTTT     AAAA   TTTTTTTTTT
 PP     PP  HH    HH  NNNN    NN   XX  XX   SS         TT  TT  TT    AA  AA  TT  TT  TT
 PPPPPPPP   HHHHHHHH  NN NN   NN     XX      SSSSSSS       TT       AA    AA     TT    
 PPPPPPP    HHHHHHHH  NN   NN NN     XX       SSSSSSS      TT      AAAAAAAAA     TT    
 PP         HH    HH  NN    NNNN   XX  XX           SS     TT     AAAAAAAAAA     TT    
PPPP       HHHH  HHHH NN     NNN  XX    XX  SSSSSSSSS     TTTT    AA      AA    TTTT   
PPPP       HHHH  HHHH NN      NN XX      XX  SSSSSSS      TTTT    AA      AA    TTTT   

  1: /****************************************************************************
  2:  *
  3:  * Copyright (c) 1985, John Forkosh Associates, Inc.  All rights reserved.
  4:  * --------------------------------------------------------------------------
  5:  *
  6:  * Structure:   phnxstat
  7:  *
  8:  * Purpose:     Describes the Phoenix return statuses that PHNXclnt
  9:  *              may return to ARCSupdt.
 10:  *
 11:  * Source:      PHNXSTAT.H
 12:  *
 13:  * Note:        This small file must be kept separate from pdata.h since
 14:  *              these symbols have nothing to do with Phoenix or the DBSA.
 15:  *
 16:  * ------------------------------------------------------------------------
 17:  * Revision History:
 18:  *
 19:  * 01/23/86     J.Forkosh       Installation.
 20:  *
 21:  ****************************************************************************/
 22: 
 23: /* ------------------------------------------------------------------------
 24:    Return Statuses from PHNXclnt
 25: --------------------------------------------------------------------------- */
 26: #define PHNX$_SUCCESS   0
 27: #define PHNX$_NOTFOUND  1
 28: #define PHNX$_BADARG    2
 29: #define PHNX$_FAILURE   3
 30: #define PHNX$_FATALERR  9
 31: /* ============================ End-of-File ============================== */


  SSSSSSS  EEEEEEEEEE   QQQQQQ   LLLLL        IIIIII   BBBBBBBB                CCCCCCC 
 SSSSSSSSS EEEEEEEEEE  QQQQQQQQ  LLLLL        IIIIII   BBBBBBBBB              CCCCCCCCC
SS          EE     EE QQ      QQ  LL            II      BB     BB            CC      CC
 SSSSSSS    EEEEEE    QQ      QQ  LL            II      BBBBBBBB    .        CC        
  SSSSSSS   EEEEEE    QQ    Q QQ  LL            II      BBBBBBBB   ...       CC        
        SS  EE     EE QQ     QQQ  LL     LL     II      BB     BB .....      CC      CC
SSSSSSSSS  EEEEEEEEEE  QQQQQQQQ  LLLLLLLLLL   IIIIII   BBBBBBBBB   ...        CCCCCCCCC
 SSSSSSS   EEEEEEEEEE   QQQQQQ Q LLLLLLLLLL   IIIIII   BBBBBBBB     .          CCCCCCC 

  1: /****************************************************************************
  2:  *
  3:  * Copyright (c) 1985, John Forkosh Associates, Inc.  All rights reserved.
  4:  * --------------------------------------------------------------------------
  5:  *
  6:  * Library:     SEQLIB.C
  7:  *
  8:  * Purpose:     Seqlib consists of a set of C-language functions that
  9:  *              access variable-length records from sequential files.
 10:  *              Instead of a file-ptr, the user declares a FAB and RAB
 11:  *              which appear in the calling sequences of:
 12:  *
 13:  *                         <-- corresponding to -->
 14:  *                      SEQLIB                  VAX C
 15:  *                      ------                  -----
 16:  *                      sopen                   fopen
 17:  *                      sread                   fread
 18:  *                      swrite                  fwrite
 19:  *                      supdate                    "
 20:  *                      srewind                 rewind
 21:  *                      sclose                  fclose
 22:  *                      sdump                   -none-
 23:  *
 24:  * Calls:
 25:  *              sopen   ( name, mode, fabp, rabp, mrs )
 26:  *              sread   ( rabp, bufp, maxc )
 27:  *              swrite  ( rabp, bufp, maxc )
 28:  *              supdate ( rabp )
 29:  *              srewind ( rabp )
 30:  *              sclose  ( fabp )
 31:  *
 32:  * Arguments:
 33:  *              name (I)        addr of char string containing the name of
 34:  *                              the file to be opened (or created).
 35:  *              mode (I)        access mode: r(ead), w(rite), or u(pdate).
 36:  *              mrs  (I)        maximum record size.
 37:  *              fabp (I/O)      addr of FAB struct for file.
 38:  *              rabp (I/O)      addr of RAB struct for file.
 39:  *              bufp (I/O)      addr of char buffer containing record
 40:  *                              to be read or written.
 41:  *              maxc (I)        max number of chars in buffer.
 42:  *
 43:  * Returns:
 44:  *              - int           see individual functions for details.
 45:  *
 46:  * Source:      SEQLIB.C
 47:  *
 48:  * --------------------------------------------------------------------------
 49:  * Revision History:
 50:  *
 51:  * 12/17/85     J.Forkosh       Installation.
 52:  *
 53:  ****************************************************************************/
 54: 
 55: #include stdio
 56: #include rms
 57: #include ssdef
 58: globaldef int   seqlib_rms_stat;        /* RMS return status */
 59: int             seqlib_ret_stat;        /* status returned to caller */
 60:  
 61: /****************************************************************************
 62:  *
 63:  * Function:    sopen
 64:  *
 65:  * Purpose:     Initializes and opens a FAB and connects a RAB to it.
 66:  *
 67:  * Returns:
 68:  *              TRUE            if existing file was opened
 69:  *              EOF             if file did not exist and was created
 70:  *              FALSE           if could not be opened, or connected
 71:  *
 72:  * Notes:
 73:  *              on write        file is positioned at end, and truncation
 74:  *                              occurs after every write.
 75:  *              on update       file is positioned at beginning, and truncation
 76:  *                              occurs after every write.
 77:  *
 78:  * --------------------------------------------------------------------------
 79:  * Revision History:
 80:  *
 81:  * 12/17/85     J.Forkosh       Installation.
 82:  *
 83:  ****************************************************************************/
 84: 
 85: sopen ( name, mode, fabp, rabp, mrs )
 86: char    *name;                          /* name of file */
 87: char    *mode;                          /* "r"(ead), "w"(rite), "u"(pdate) */
 88: struct  FAB *fabp;                      /* addr of file access block */
 89: struct  RAB *rabp;                      /* addr of record access block */
 90: int     mrs;                            /* maximum record size (in bytes) */
 91: {
 92:         
 93: /* ---------------------------------------------------------------------------
 94: Initialize FAB
 95: --------------------------------------------------------------------------- */
 96: *fabp = cc$rms_fab;                     /* default initial values */
 97: fabp->fab$l_fna = name;                 /* file name */
 98: fabp->fab$b_fns = strlen(name);         /* file name size   */
 99: fabp->fab$w_mrs = mrs;                  /* no max limit on rec size */
100: fabp->fab$b_org = FAB$C_SEQ;            /* sequential access */
101: fabp->fab$b_rat = FAB$M_CR;             /* implied CR at end of recs*/
102: fabp->fab$b_rfm = FAB$C_VAR;
103: 
104: if ( !strcmp(mode, "r") )               /* read access */
105:         {
106:         fabp->fab$b_fac = FAB$M_GET;
107:         fabp->fab$l_fop = FAB$M_CIF | FAB$M_SQO;
108:         }
109: if ( !strcmp(mode, "w") )               /* write access */
110:         {
111:         fabp->fab$b_fac = FAB$M_PUT;
112:         fabp->fab$l_fop = FAB$M_SUP|FAB$M_SQO|FAB$M_TEF;
113:         rabp->rab$l_rop = RAB$M_EOF;
114:         }
115: if ( !strcmp(mode, "u") )               /* update access */
116:         {
117:         fabp->fab$b_fac = FAB$M_GET | FAB$M_PUT| FAB$M_UPD;
118:         fabp->fab$l_fop = FAB$M_CIF | FAB$M_SQO;
119:         }
120: 
121: /* ---------------------------------------------------------------------------
122: Initialize RAB
123: --------------------------------------------------------------------------- */
124: *rabp = cc$rms_rab;                     /* default initial values */
125: rabp->rab$l_fab = fabp;                 /* point RAB to FAB */
126: rabp->rab$b_rac = RAB$C_SEQ;            /* sequential access */
127: 
128: /* ---------------------------------------------------------------------------
129: Open the FAB
130: --------------------------------------------------------------------------- */
131: seqlib_rms_stat = sys$create(fabp);     /* Issue $create */
132: if ( seqlib_rms_stat == RMS$_NORMAL )
133:         seqlib_ret_stat = TRUE;
134: else
135:         if ( (seqlib_rms_stat == RMS$_CREATED) 
136:                 || (seqlib_rms_stat == RMS$_SUPERSEDE) )
137:                 seqlib_ret_stat = EOF;
138:         else
139:                 {
140:                 seqlib_ret_stat = FALSE;
141:                 return ( seqlib_ret_stat );
142:                 }
143: 
144: /* ---------------------------------------------------------------------------
145: Connect the RAB and return
146: --------------------------------------------------------------------------- */
147: seqlib_rms_stat = sys$connect(rabp);
148: if ( seqlib_rms_stat != RMS$_NORMAL )
149:         seqlib_ret_stat = FALSE;
150: return ( seqlib_ret_stat );
151: }
152:  
153: /****************************************************************************
154:  *
155:  * Function:    sread
156:  *
157:  * Purpose:     Reads a block and returns its size.
158:  *
159:  * Returns:
160:  *              # bytes read    if success
161:  *              EOF             if end-of-file
162:  *              FALSE           if failure
163:  *
164:  * --------------------------------------------------------------------------
165:  * Revision History:
166:  *
167:  * 12/17/85     J.Forkosh       Installation.
168:  *
169:  ****************************************************************************/
170: 
171: sread   ( rabp, bufp, maxc )
172: struct  RAB *rabp;
173: char    *bufp;
174: int     maxc;
175: {
176: rabp->rab$l_ubf = bufp;
177: rabp->rab$w_usz = maxc;
178: seqlib_rms_stat = sys$get ( rabp );
179: if ( seqlib_rms_stat == RMS$_NORMAL )
180:         seqlib_ret_stat = rabp->rab$w_rsz;
181: else
182:         if ( seqlib_rms_stat == RMS$_EOF )
183:                 seqlib_ret_stat = EOF;
184:         else
185:                 seqlib_ret_stat = FALSE;
186: return ( seqlib_ret_stat );
187: }
188:  
189: /****************************************************************************
190:  *
191:  * Function:    swrite
192:  *
193:  * Purpose:     Writes a block.
194:  *
195:  * Returns:
196:  *              TRUE            if success
197:  *              FALSE           if failure
198:  *
199:  * --------------------------------------------------------------------------
200:  * Revision History:
201:  *
202:  * 12/17/85     J.Forkosh       Installation.
203:  *
204:  ****************************************************************************/
205: 
206: swrite  ( rabp, bufp, maxc )
207: struct  RAB *rabp;                      /* record access block */
208: char    *bufp;                          /* record to be written */
209: int     maxc;                           /* length of record */
210: {
211: rabp->rab$l_rbf = bufp;
212: rabp->rab$w_rsz = maxc;
213: seqlib_rms_stat = sys$put ( rabp );
214: if ( seqlib_rms_stat == RMS$_NORMAL )
215:         seqlib_ret_stat = TRUE;
216: else
217:         seqlib_ret_stat = FALSE;
218: return ( seqlib_ret_stat );
219: }
220:  
221: /****************************************************************************
222:  *
223:  * Function:    supdate
224:  *
225:  * Purpose:     Updates the record referenced to by the last get.
226:  *
227:  * Returns:
228:  *              TRUE            if success
229:  *              FALSE           if failure
230:  *
231:  * Notes:       Size and address must be the same.
232:  *
233:  * --------------------------------------------------------------------------
234:  * Revision History:
235:  *
236:  * 12/17/85     J.Forkosh       Installation.
237:  *
238:  ****************************************************************************/
239: 
240: supdate ( rabp )
241: struct  RAB *rabp;                      /* record access block */
242: {
243: seqlib_rms_stat = sys$update ( rabp );
244: if ( seqlib_rms_stat == RMS$_NORMAL )
245:         seqlib_ret_stat = TRUE;
246: else
247:         seqlib_ret_stat = FALSE;
248: return(seqlib_ret_stat);
249: }
250:  
251: /****************************************************************************
252:  *
253:  * Function:    srewind
254:  *
255:  * Purpose:     Positions a file at the beginning.
256:  *
257:  * Returns:
258:  *              TRUE            if success
259:  *              FALSE           if failure
260:  *
261:  * --------------------------------------------------------------------------
262:  * Revision History:
263:  *
264:  * 12/17/85     J.Forkosh       Installation.
265:  *
266:  ****************************************************************************/
267: 
268: srewind ( rabp )
269: struct  RAB *rabp;                      /* record access block */
270: {
271: seqlib_rms_stat = sys$rewind ( rabp );
272: if ( seqlib_rms_stat == RMS$_NORMAL )
273:         seqlib_ret_stat = TRUE;
274: else
275:         seqlib_ret_stat = FALSE;
276: return ( seqlib_ret_stat );
277: }
278:  
279: /****************************************************************************
280:  *
281:  * Function:    sclose
282:  *
283:  * Purpose:     Close a file.
284:  *
285:  * Returns:
286:  *              TRUE            if success
287:  *              FALSE           if failure
288:  *
289:  * --------------------------------------------------------------------------
290:  * Revision History:
291:  *
292:  * 12/17/85     J.Forkosh       Installation.
293:  *
294:  ****************************************************************************/
295: 
296: sclose  ( fabp )
297: struct  FAB *fabp;                      /* file access block */
298: {
299: seqlib_rms_stat = sys$close ( fabp );
300: if ( seqlib_rms_stat == RMS$_NORMAL )
301:         seqlib_ret_stat = TRUE;
302: else
303:         seqlib_ret_stat = FALSE;
304: return ( seqlib_ret_stat );
305: }
306:  
307: /****************************************************************************
308:  *
309:  * Function:    sdump
310:  *
311:  * Purpose:     Dumps a buffer in hex and ascii.
312:  *
313:  * --------------------------------------------------------------------------
314:  * Revision History:
315:  *
316:  * 12/17/85     J.Forkosh       Installation.
317:  *
318:  ****************************************************************************/
319: 
320: sdump   ( p, n )
321: char    *p;                             /* pointer to buffer */
322: int     n;                              /* number of chars to dump */
323: {
324: 
325: /* ---------------------------------------------------------------------------
326: Declarations and Allocations
327: --------------------------------------------------------------------------- */
328: int     i;                              /* index over buf 16 chars at a time */
329: int     j;                              /* index over 16 chars on each line */
330: char    c;                              /* char being dumped */
331: char    hexstr[9];                      /* hex value of char in ascii string */
332: 
333: /* ---------------------------------------------------------------------------
334: Loop over buffer 16 chars at a time
335: --------------------------------------------------------------------------- */
336: for ( i=0; i < n; i += 16 )
337:         {
338:         if ( i%320 == 0 )                       /* new page every 20 lines */
339:                 {
340:                 if ( i > 0 )
341:                         {
342:                         printf("\n...More...  Press RETURN to Continue -->");
343:                         gets(hexstr);
344:                         if ( strlen(hexstr) > 0 )
345:                                 return;         /* abort if user enters char */
346:                         }
347:                 printf("\fDump %x bytes from %x", n, p);
348:                 }
349:         printf("\n%10.10X: ", p + i);           /* print addr on new line */
350:         j = 0;
351:         while ( (j < 16) && (i + j < n) )       /* hex dump of next 16 chars */
352:                 {
353:                 c = *(p + i + j++);
354:                 sprintf(hexstr, "%08X ", c);
355:                 printf("%2.2s ",&hexstr[6]);
356:                 }
357:         printf("\t");                           /* tab line to ascii field */
358:         j = 0;
359:         while ( ( j < 16) && ( i + j < n) )     /* ditto for ascii dump */
360:                 {
361:                 c = *(p + i + j++);
362:                 if ( (c >= 0x20) && (c <= 0x7f) )
363:                         printf("%c",c);
364:                 else
365:                         printf(".");
366:                 }
367:         }                               /* end for -- dump next 16 chars */
368: printf("\nDone.  Press RETURN to Continue -->");
369: gets(hexstr);
370: return;
371: }


TTTTTTTTTT RRRRRRRR   NN      NN LLLLL        OOOOOO     GGGGGG                CCCCCCC 
TTTTTTTTTT RRRRRRRRR  NNN     NN LLLLL       OOOOOOOO   GGGGGGGG              CCCCCCCCC
TT  TT  TT  RR     RR NNNN    NN  LL        OO      OO GG                    CC      CC
    TT      RRRRRRRR  NN NN   NN  LL        OO      OO GG    GGG    .        CC        
    TT      RRRRRRR   NN   NN NN  LL        OO      OO GG   GGGGG  ...       CC        
    TT      RR   RR   NN    NNNN  LL     LL OO      OO GG      GG .....      CC      CC
   TTTT     RR    RR  NN     NNN LLLLLLLLLL  OOOOOOOO   GGGGGGGG   ...        CCCCCCCCC
   TTTT     RR     RR NN      NN LLLLLLLLLL   OOOOOO     GGGGGG     .          CCCCCCC 

  1: /****************************************************************************
  2:  *
  3:  * Copyright (c) 1985, John Forkosh Associates, Inc.  All rights reserved.
  4:  * --------------------------------------------------------------------------
  5:  *
  6:  * Function:    trnlog
  7:  *
  8:  * Purpose:     Translates a VMS logical name.
  9:  *
 10:  * Call:        trnlog ( lognam, logval )
 11:  *
 12:  * Arguments:
 13:  *              lognam (I)      addr of char string containing logical name
 14:  *                              to be translated.
 15:  *              logval (O)      addr of char string containing translated value
 16:  *                              upon return.
 17:  *
 18:  * Returns:
 19:  *              SS$_NORMAL      for successful completion
 20:  *
 21:  * Source:      TRNLOG.C
 22:  *
 23:  * Note:        This routine must be replaced by a call to $trnlnm
 24:  *              for VMS 4.x
 25:  *
 26:  * --------------------------------------------------------------------------
 27:  * Revision History:
 28:  *
 29:  * 12/16/85     J.Forkosh       Installation.
 30:  *
 31:  ****************************************************************************/
 32: 
 33: #include descrip
 34: #include ssdef
 35: 
 36: trnlog( lognam, logval )
 37: char    *lognam;
 38: char    *logval;
 39: {
 40: 
 41: /* ---------------------------------------------------------------------------
 42:    Allocations and Declarations
 43: --------------------------------------------------------------------------- */
 44: int     vms_stat;                       /* VMS returned status */
 45: short   rsllen;                         /* Length of translated string */
 46: static  char logbuf[64];                /* Logical name */
 47: static  char rslbuf[256];               /* Translated string */
 48: char    table;                          /* Number of table with logical name */
 49: char    acmode;                         /* Access mode for process entry */
 50: static  struct  dsc$descriptor_s
 51:         log_desc = { 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, &logbuf[0] },
 52:         rsl_desc = { 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, &rslbuf[0] };
 53: 
 54: /* ---------------------------------------------------------------------------
 55:    Initialize args, Issue $trnlog, and Return translated value.
 56: --------------------------------------------------------------------------- */
 57: strcpy ( logbuf, lognam );              /* Copy input name to descriptor */
 58: log_desc.dsc$w_length = strlen(logbuf);
 59: rsl_desc.dsc$w_length = 255;
 60: 
 61: vms_stat = sys$trnlog                   /* Issue $trnlog */
 62:                 (
 63:                 &log_desc,              /* Logical name */
 64:                 &rsllen,                /* Length of value */
 65:                 &rsl_desc,              /* Translated value */
 66:                 &table,                 /* Logical table */
 67:                 &acmode,                /* Access mode */
 68:                 0                       /* Disable table search */
 69:                 );
 70: 
 71: logval[0] = '\0';                       /* Null string for abnormal return */
 72: if ( vms_stat == SS$_NORMAL )           /* Copy $trnlog output if successful */
 73:         {
 74:         if ( rsllen > 255 ) rsllen=255;
 75:         strncpy( logval, rslbuf, rsllen);
 76:         logval[rsllen] = '\0';
 77:         }
 78: return( vms_stat );
 79: }


VV      VV MM      MM   SSSSSSS  MM      MM   SSSSSSS    GGGGGG                CCCCCCC 
VV      VV MMM    MMM  SSSSSSSSS MMM    MMM  SSSSSSSSS  GGGGGGGG              CCCCCCCCC
VV      VV MMMM  MMMM SS         MMMM  MMMM SS         GG                    CC      CC
VV      VV MM MMMM MM  SSSSSSS   MM MMMM MM  SSSSSSS   GG    GGG    .        CC        
 VV    VV  MM  MM  MM   SSSSSSS  MM  MM  MM   SSSSSSS  GG   GGGGG  ...       CC        
  VV  VV   MM      MM         SS MM      MM         SS GG      GG .....      CC      CC
   VVVV    MM      MM SSSSSSSSS  MM      MM SSSSSSSSS   GGGGGGGG   ...        CCCCCCCCC
    VV     MM      MM  SSSSSSS   MM      MM  SSSSSSS     GGGGGG     .          CCCCCCC 

  1: /****************************************************************************
  2:  *
  3:  * Copyright (c) 1985, John Forkosh Associates, Inc.  All rights reserved.
  4:  * --------------------------------------------------------------------------
  5:  *
  6:  * Function:    vmsmsg
  7:  *
  8:  * Purpose:     Returns text of VMS message corresponding to SS$_status.
  9:  *
 10:  * Call:        vmsmsg ( vms_stat )
 11:  *
 12:  * Arguments:
 13:  *              vms_stat (I)    int SS$_ status.
 14:  *
 15:  * Returns:     (char *)        address of char string containing message.
 16:  *              
 17:  * Source:      VMSMSG.C
 18:  *
 19:  * --------------------------------------------------------------------------
 20:  * Revision History:
 21:  *
 22:  * 12/11/85     J.Forkosh       Installation.
 23:  *
 24:  ****************************************************************************/
 25: 
 26: #include descrip
 27: 
 28: char *vmsmsg (vms_stat)
 29: int vms_stat;
 30: {
 31: /* -------------------------------------------------------------------------
 32: Allocations and Declarations
 33: -------------------------------------------------------------------------- */
 34: static  char msgbuf[256];                       /* VMS error message buffer */
 35: int     msglen;                                 /* message length */
 36: struct  dsc$descriptor_s                        /* message descriptor */
 37:         msg_desc = { 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, &msgbuf[0] };
 38: char    outadr[4];                              /* dummy getmsg array */
 39: 
 40: /* -------------------------------------------------------------------------
 41: Issue $getmsg and print message
 42: -------------------------------------------------------------------------- */
 43: msg_desc.dsc$w_length = 255;                            /* Init msg length */
 44: sys$getmsg(vms_stat, &msglen, &msg_desc, 0xF, outadr ); /* 0xF for full msg */
 45: if (msglen > 255) msglen=255;                           /* max msg size */
 46: msgbuf[msglen] = '\0';                                  /* null-terminate it */
 47: return ( msgbuf );                                      /* and go home */
 48: }

Copyright © 1985-2010, John Forkosh Associates, Inc.   All rights reserved.
email: john@forkosh.com