| 1 | PSAUP3 ;BIR/JMB-Upload and Process Prime Vendor Invoice Data - CONT'D ;7/23/97
 | 
|---|
| 2 |  ;;3.0; DRUG ACCOUNTABILITY/INVENTORY INTERFACE;; 10/24/97
 | 
|---|
| 3 |  ;This routine checks for correct X12 formating.
 | 
|---|
| 4 |  ;
 | 
|---|
| 5 | ORDER ;  check order of code sheets
 | 
|---|
| 6 |  ;  isa   <--------------+
 | 
|---|
| 7 |  ;    gs    <----------+ |
 | 
|---|
| 8 |  ;      st    <------+ | |
 | 
|---|
| 9 |  ;      | big        | | |
 | 
|---|
| 10 |  ;      | it1   <--+ | | |
 | 
|---|
| 11 |  ;      | ...      | | | |--repeats
 | 
|---|
| 12 |  ;      | it1   <--+ | | |
 | 
|---|
| 13 |  ;      | ctt        | | |
 | 
|---|
| 14 |  ;      se    <------+ | |
 | 
|---|
| 15 |  ;    ge    <----------+ |
 | 
|---|
| 16 |  ;  iea   <--------------+
 | 
|---|
| 17 |  S PSANEXT=$P(PSADATA,"^")
 | 
|---|
| 18 |  ;
 | 
|---|
| 19 |  I PSALAST="GE",PSANEXT="GS" Q
 | 
|---|
| 20 |  I PSALAST="GE",PSANEXT'="IEA" D ORDERROR("GE",PSANEXT,"IEA") Q
 | 
|---|
| 21 |  ;
 | 
|---|
| 22 |  I PSALAST="ISA",PSANEXT'="GS" D ORDERROR("ISA",PSANEXT,"GS") Q
 | 
|---|
| 23 |  ;
 | 
|---|
| 24 |  I PSALAST="SE",PSANEXT="ST" Q
 | 
|---|
| 25 |  I PSALAST="SE",PSANEXT'="GE" D ORDERROR("SE",PSANEXT,"GE") Q
 | 
|---|
| 26 |  ;
 | 
|---|
| 27 |  I PSALAST="GS",PSANEXT'="ST" D ORDERROR("GS",PSANEXT,"ST") Q
 | 
|---|
| 28 |  ;
 | 
|---|
| 29 |  I PSALAST="CTT",PSANEXT'="SE" D ORDERROR("CTT",PSANEXT,"SE") Q
 | 
|---|
| 30 |  ;
 | 
|---|
| 31 |  I PSALAST="ST",PSANEXT'="BIG" D ORDERROR("ST",PSANEXT,"BIG") Q
 | 
|---|
| 32 |  ;
 | 
|---|
| 33 |  I PSALAST="IT1",PSANEXT="IT1" Q
 | 
|---|
| 34 |  I PSALAST="IT1",PSANEXT'="CTT"&(PSANEXT'="TDS") D ORDERROR("IT1",PSANEXT,"CTT") Q
 | 
|---|
| 35 |  Q
 | 
|---|
| 36 |  ;
 | 
|---|
| 37 | ORDERROR(PSALAST,PSANEW,PSAEXPEC) ;Segments out of order
 | 
|---|
| 38 |  ;ISA segment should be first
 | 
|---|
| 39 |  I PSALAST="" S PSASEG="ORDER1" D MSG^PSAUTL2 Q
 | 
|---|
| 40 |  ;Segments other than ISA
 | 
|---|
| 41 |  S PSASEG="ORDER2" D MSG^PSAUTL2
 | 
|---|
| 42 |  Q
 | 
|---|