Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: DDXP1

DDXP1.m

Go to the documentation of this file.
  1. DDXP1 ;SFISC/DPC-CREATE/EDIT FOREIGN FORMAT ;1/8/93 09:09
  1. ;;22.2;VA FileMan;;Jan 05, 2016;Build 42
  1. ;;Per VA Directive 6402, this routine should not be modified.
  1. ;;Submitted to OSEHRA 5 January 2015 by the VISTA Expertise Network.
  1. ;;Based on Medsphere Systems Corporation's MSC FileMan 1051.
  1. ;;Licensed under the terms of the Apache License, Version 2.0.
  1. ;
  1. EN1 ;
  1. K DA S DLAYGO=0
  1. GETFF ;
  1. W !
  1. S DIC="^DIST(.44,",DIC(0)="QEALMZ" D ^DIC K DIC
  1. G:Y=-1 QUIT
  1. S DDXPFMNM=$P(Y,U,2),DDXPFMNO=+Y
  1. I $P(Y(0),U,9) D USEDFF G:'($D(DA)#2) GETFF
  1. EDITFF ;
  1. S:'($D(DA)#2) DA=DDXPFMNO S DDSFILE="^DIST(.44,",DR="[DDXP FF FORM1]"
  1. D ^DDS
  1. QUIT ;
  1. K DDXPFMNM,DDXPFMNO,DA,DR,DDSFILE,Y,DLAYGO,X
  1. Q
  1. USEDFF ;
  1. W !!,DDXPFMNM_" foreign format has been used to create an Export Template."
  1. W !,"Therefore, its definition cannot be changed.",!
  1. S DIR(0)="YA",DIR("A")="Do you want to see the contents of "_DDXPFMNM_" format? ",DIR("B")="NO"
  1. D ^DIR K DIR Q:$D(DIRUT)
  1. I Y W !! S DIC="^DIST(.44,",DA=DDXPFMNO D EN^DIQ K DIC,DA
  1. S DIR(0)="YA",DIR("A")="Do you want to use "_DDXPFMNM_" as the basis for a new format? ",DIR("B")="NO"
  1. D ^DIR K DIR Q:$D(DIRUT)!('Y)
  1. NEWFF S DIC="^DIST(.44,",DIC(0)="QEAL",DIC("A")="Name for new FOREIGN FORMAT: " W !
  1. D ^DIC K DIC Q:$D(DTOUT)!($D(DUOUT))!(X="")
  1. I '$P(Y,U,3) W !,$C(7),$P(Y,U,2)_" is already being used.",!,"Please enter a new name for the format.",! G NEWFF
  1. S DDXPFMNM=$P(Y,U,2),(DIT("F"),DIT("T"))="^DIST(.44,",DA("F")=DDXPFMNO,(DA("T"),DDXPFMNO)=+Y D EN^DIT0
  1. S DIE="^DIST(.44,",DA=DDXPFMNO,DR="40///0" D ^DIE K DIT,DIE,DR,Y
  1. Q
  1. ;
  1. FORMVAL ;
  1. N FLDLM,FIXREC,MSGCNT,ERRMSG,USEQT,MAXLEN,SUBNULL S DDSERROR=0,MSGCNT=1
  1. S FLDLM=$$GET^DDSVAL(DIE,DA,1),FIXREC=$$GET^DDSVAL(DIE,DA,5),USEQT=$$GET^DDSVAL(DIE,DA,8),MAXLEN=$$GET^DDSVAL(DIE,DA,7),SUBNULL=$$GET^DDSVAL(DIE,DA,11)
  1. I FIXREC D
  1. . I FLDLM]"" D
  1. . . S DDSERROR=DDSERROR+1
  1. . . S ERRMSG(MSGCNT)="You cannot specify a record delimiter and",MSGCNT=MSGCNT+1
  1. . . S ERRMSG(MSGCNT)="indicate that record lengths are fixed",MSGCNT=MSGCNT+1
  1. . . S ERRMSG(MSGCNT)="for the same foreign format.",MSGCNT=MSGCNT+1
  1. . . Q
  1. . I USEQT D
  1. . . S DDSERROR=DDSERROR+1
  1. . . S ERRMSG(MSGCNT)="You cannot choose to have non-numeric fields quoted",MSGCNT=MSGCNT+1
  1. . . S ERRMSG(MSGCNT)="when you are exporting fixed length records.",MSGCNT=MSGCNT+1
  1. . . Q
  1. . I MAXLEN>255 D
  1. . . S DDSERROR=DDSERROR+1
  1. . . S ERRMSG(MSGCNT)="You cannot set the Maximum Record Length larger than 255 characters ",MSGCNT=MSGCNT+1
  1. . . S ERRMSG(MSGCNT)="when you are defining a fixed record length format.",MSGCNT=MSGCNT+1
  1. . . Q
  1. . I SUBNULL]"" D
  1. . . S DDSERROR=DDSERROR+1
  1. . . S ERRMSG(MSGCNT)="During fixed length exports, null values will always be exported as nothing.",MSGCNT=MSGCNT+1
  1. . . S ERRMSG(MSGCNT)="So, you cannot specify characters to be substituted for null numeric values.",MSGCNT=MSGCNT+1
  1. . . Q
  1. . Q
  1. I DDSERROR D
  1. . S ERRMSG(MSGCNT)=" ",MSGCNT=MSGCNT+1
  1. . S ERRMSG(MSGCNT)="Please correct "_$S(DDSERROR>1:"these discrepancies.",1:"this discrepancy."),MSGCNT=MSGCNT+1
  1. . S ERRMSG(MSGCNT)="You CANNOT save the form until you correct it!"
  1. . Q
  1. D:DDSERROR MSG^DDSUTL(.ERRMSG)
  1. K:'DDSERROR DDSERROR
  1. Q