source: WorldVistAEHR/trunk/r/IFCAP-PRC-PRX--PRCA--PRCN/PRCHES9.m@ 1141

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

initial load of WorldVistAEHR

File size: 2.0 KB
Line 
1PRCHES9 ;WISC/RHD/AKS-ESIG MAINTENANCE ROUTINE ;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 114 (ISMS CODE SHEET ELEC. SIG), FILE 442
5DECODE(LEVEL0) ;return esig to readable form
6 NEW RECORD,RECORD1,RECORD21,VERSION,PERSON,SIG,CHECKSUM
7 S RECORD=$G(^PRC(442,LEVEL0,0)) I RECORD="" Q ""
8 S RECORD21=$G(^PRC(442,LEVEL0,21))
9 S VERSION=$P(RECORD21,"^",6)
10 S PERSON=+$P(RECORD21,"^",3)
11 I VERSION'="",VERSION'=1 Q ""
12 S SIG=$P(RECORD21,"^",4)
13D1 ;decode esig for version 1
14 S CHECKSUM=$$SUM^PRCUESIG(LEVEL0_"^"_$$STRING(RECORD21))
15 Q $$DECODE^PRCUESIG(SIG,PERSON,CHECKSUM)
16ENCODE(LEVEL0,USERNUM,Y) ;Encode esig for version 1 only
17 NEW RECORD,RECORD21,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 RECORD21=$G(^PRC(442,LEVEL0,21))
24 I RECORD="" S Y=-1 Q ;-1 no record
25 I $P(RECORD21,"^",4)'="" S Y=-4 Q ;-4 cannot re-sign record
26 S OLDUSER=+$P(RECORD21,"^",3)
27 I OLDUSER=0 S $P(RECORD21,"^",3)=USERNUM
28 I OLDUSER>0 S USERNUM=OLDUSER
29 S:$P(RECORD21,"^",5)="" $P(RECORD21,"^",5)=$$NOW^PRCUESIG
30 S CHECKSUM=$$SUM^PRCUESIG(LEVEL0_"^"_$$STRING(RECORD21))
31 S $P(RECORD21,"^",4)=$$ENCODE^PRCUESIG(SIGBLOCK,USERNUM,CHECKSUM)
32 S $P(RECORD21,"^",6,7)="1^"_$$SUM^PRCUESIG(SIGBLOCK)
33 S ^PRC(442,LEVEL0,21)=RECORD21
34 S Y=1 Q
35REMOVE(LEVEL0) ;Entry point to remove esig
36 NEW I,RECORD21
37 S RECORD21=$G(^PRC(442,LEVEL0,21)) Q:RECORD21=""
38 F I=3,4,5,7 S $P(RECORD21,"^",I)=""
39 S ^PRC(442,LEVEL0,21)=RECORD21
40 Q
41VERIFY(LEVEL0) ;verify ver 1 signature. Returns 1 if valid
42 NEW RECORD,RECORD1,RECORD21,VERSION,SIGBLOCK
43 S RECORD21=$G(^PRC(442,LEVEL0,21))
44 S VERSION=$P(RECORD21,"^",6),SIGBLOCK=$P(RECORD21,"^",7)
45 I VERSION_SIGBLOCK="" Q 1
46 Q ($$SUM^PRCUESIG($$DECODE(LEVEL0))=SIGBLOCK)
47STRING(X21) ;Build String of critical fields
48 Q $P(X21,"^",1)_"^"_$P(X21,"^",5)
Note: See TracBrowser for help on using the repository browser.