source: WorldVistAEHR/trunk/r/IFCAP-PRC-PRX--PRCA--PRCN/PRCHES8.m@ 1154

Last change on this file since 1154 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 1.9 KB
RevLine 
[613]1PRCHES8 ;WISC/RHD/AKS-ESIG MAINT ;3/18/93 15:38
2V ;;5.1;IFCAP;;Oct 20, 2000
3 ;Per VHA Directive 10-93-142, this routine should not be modified.
4 ;ROUTINE FOR MAINTAINING FIELD 105 (LOG CODE SHEET ELEC. SIG), FILE 442
5DECODE(LEVEL0) ;return esig to readable form
6 NEW RECORD,RECORD1,RECORD18,VERSION,PERSON,SIG,CHECKSUM
7 S RECORD=$G(^PRC(442,LEVEL0,0)) I RECORD="" Q ""
8 S RECORD18=$G(^PRC(442,LEVEL0,18))
9 S VERSION=$P(RECORD18,"^",15)
10 S PERSON=+$P(RECORD18,"^",5)
11 I VERSION'="",VERSION'=1 Q ""
12 S SIG=$P(RECORD18,"^",6)
13D1 ;decode e signature for version 1
14 S CHECKSUM=$$SUM^PRCUESIG(LEVEL0_"^"_$$STRING(RECORD18))
15 Q $$DECODE^PRCUESIG(SIG,PERSON,CHECKSUM)
16ENCODE(LEVEL0,USERNUM,Y) ;Encode esig for ver 1 only
17 NEW RECORD,RECORD18,SIGBLOCK,CHECKSUM,OLDUSER
18 S USERNUM=+USERNUM
19 I USERNUM=0 S Y=-3 Q ;-3 no user number
20 S SIGBLOCK=$P($G(^VA(200,USERNUM,20)),"^",2)
21 I SIGBLOCK="" S Y=-2 Q ;-2 no signature block
22 S RECORD=$G(^PRC(442,LEVEL0,0))
23 S RECORD18=$G(^PRC(442,LEVEL0,18))
24 I RECORD="" S Y=-1 Q ;-1 no record
25 I $P(RECORD18,"^",6)'="" S Y=-4 Q ;-4 cannot re-sign record
26 S OLDUSER=+$P(RECORD18,"^",5)
27 I OLDUSER=0 S $P(RECORD18,"^",5)=USERNUM
28 I OLDUSER>0 S USERNUM=OLDUSER
29 S:$P(RECORD18,"^",7)="" $P(RECORD18,"^",7)=$$NOW^PRCUESIG
30 S CHECKSUM=$$SUM^PRCUESIG(LEVEL0_"^"_$$STRING(RECORD18))
31 S $P(RECORD18,"^",6)=$$ENCODE^PRCUESIG(SIGBLOCK,USERNUM,CHECKSUM)
32 S $P(RECORD18,"^",15,16)="1^"_$$SUM^PRCUESIG(SIGBLOCK)
33 S ^PRC(442,LEVEL0,18)=RECORD18
34 S Y=1 Q
35REMOVE(LEVEL0) ;Entry point to remove esig
36 NEW I,RECORD18
37 S RECORD18=$G(^PRC(442,LEVEL0,18)) Q:RECORD18=""
38 F I=5,6,7,16 S $P(RECORD18,"^",I)=""
39 S ^PRC(442,LEVEL0,18)=RECORD18
40 Q
41VERIFY(LEVEL0) ;verify ver 1 sig Returns 1 if valid
42 NEW RECORD18,VERSION,SIGBLOCK
43 S RECORD18=$G(^PRC(442,LEVEL0,18))
44 S VERSION=$P(RECORD18,"^",15),SIGBLOCK=$P(RECORD18,"^",16)
45 I VERSION_SIGBLOCK="" Q 1
46 Q ($$SUM^PRCUESIG($$DECODE(LEVEL0))=SIGBLOCK)
47STRING(X18) ;Build String of critical fields
48 Q $P(X18,"^",7)
Note: See TracBrowser for help on using the repository browser.