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

DDXP31.m

Go to the documentation of this file.
  1. DDXP31 ;SFISC/DPC-CREATE EXPORT TEMPLATE ;30SEP2004
  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. XPT ;
  1. N DIC,DIR,DLAYGO
  1. W ! S DDXPOUT=0
  1. ;S DIR(0)="F^2:30",DIR("A")="Enter name for EXPORT Template"
  1. ;S DIR("?",1)="Enter the name of the Export Template to be produced.",DIR("?",2)="The name must be from 2 to 30 characters." ;,DIR("?")="The new Export Template cannot overwrite an existing Print Template file entry."
  1. ;D ^DIR
  1. ;I $D(DIRUT) S DDXPOUT=1 Q
  1. S DIC("S")="I $P(^(0),U,8)=3,$P(^(0),U,4)=DDXPFINO,$P(^(0),U,5)=DUZ!'$P(^(0),U,5)" ;**GFT Let them pick one of their own existing EXPORT TEMPLATES for this FILE
  1. S DIC="^DIPT(",DIC(0)="AOVELZ",DLAYGO=0 W ! D ^DIC I Y<0 S DDXPOUT=1 Q
  1. I '$P(Y,U,3) S $P(^(0),U,4)="",X=0 F S X=$O(^(X)) Q:X="" K ^(X) ;Throw away FILE so it can be stuffed back. throw away rest of Template
  1. ;'$P(Y,U,3) W !,$C(7),$P(Y,U,2)_" entry in the Print Template file already exists.",!,"Please enter the name of a new template.",!! G XPT
  1. S DDXPXTNO=+Y
  1. Q
  1. ;
  1. LENGTH ;
  1. W !!,"This template will produce fixed length records."
  1. W !,"Enter the length of each field below."
  1. W !,"The specified number should be the length in the TARGET file.",!!
  1. D GETOUT Q:DDXPOUT
  1. S DDXPTLEN=0
  1. S DIR(0)="N^1:255:0",DIR("?")="Enter a number from 1 to 255 as the length of this field in the TARGET file"
  1. F DDXPFLD=1:1:DDXPTOTF D I DDXPOUT Q G LENGTH
  1. . I DDXPNOUT(DDXPFLD) S DDXPFLEN(DDXPFLD)=0 Q
  1. . S DIR("A")=DDXPFCAP(DDXPFLD),DDXPOUT=0 D ^DIR
  1. . I $D(DIRUT) S DDXPOUT=1 Q
  1. . S DDXPFLEN(DDXPFLD)=Y,DDXPTLEN=DDXPTLEN+Y
  1. . Q
  1. K DIR,X,Y
  1. Q
  1. FLDNAME ;
  1. W !!,"Enter the name of the fields below in the TARGET file."
  1. W !,"If you press <RET>, no name will be used.",!!
  1. D GETOUT Q:DDXPOUT
  1. S DIR(0)="FO^0:30"
  1. S DIR("?")="Enter up to 30 characters as the name of this field in the TARGET file"
  1. F DDXPFLD=1:1:DDXPTOTF D I DDXPOUT=1 Q G FLDNAME
  1. . I DDXPNOUT(DDXPFLD) Q
  1. . S DIR("A")=DDXPFCAP(DDXPFLD),DDXPOUT=0 D ^DIR
  1. . I $D(DTOUT)!$D(DUOUT) S DDXPOUT=1 Q
  1. . S DDXPFFNM(DDXPFLD)=Y
  1. . Q
  1. K DIR,X,Y
  1. Q
  1. DTYPE ;
  1. W !!,"Enter the data types of the fields being exported below.",!!
  1. D GETOUT Q:DDXPOUT
  1. S DIR(0)=".42,1"
  1. F DDXPFLD=1:1:DDXPTOTF D I DDXPOUT=1 Q G DTYPE
  1. . I DDXPNOUT(DDXPFLD) Q
  1. . S DIR("A")=DDXPFCAP(DDXPFLD),DIR("B")=$P(^DI(.81,DDXPDT(DDXPFLD),0),U,1),DDXPOUT=0 D ^DIR
  1. . I $D(DIRUT) S DDXPOUT=1 Q
  1. . S DDXPDT(DDXPFLD)=+Y
  1. . Q
  1. K DIR,X,Y
  1. Q
  1. IOM ;
  1. S DDXPOUT=0
  1. W !!,"Enter the maximum length of a physical record that can be exported.",!,"Enter '^' to stop the creation of an EXPORT template.",!
  1. I $D(DDXPTLEN) D
  1. . W "The default shown is based on the total lengths of the fields being exported.",!
  1. . S DIR("B")=DDXPTLEN+1
  1. . Q
  1. RIOM S DIR(0)=".44,7" D ^DIR K DIR
  1. I $D(DTOUT)!$D(DUOUT) S DDXPOUT=1 Q
  1. I Y>255,$P(DDXPFMZO,U,6) W !!,$C(7),"The length cannot be greater than 255 when sending fixed length records.",! G RIOM
  1. S DDXPIOM=Y
  1. Q
  1. ;
  1. ASKDELM ;
  1. S DDXPOUT=0
  1. W !!,"You can choose a delimiter to be placed between output fields.",!,"Enter <RET> to use no delimiter.",!,"Enter '^' to stop the creation of an EXPORT template.",!
  1. S DIR(0)=".44,1" D ^DIR K DIR
  1. I $D(DUOUT)!$D(DTOUT) S DDXPOUT=1 Q
  1. S:X="@" Y=X S DDXPDELM=Y
  1. Q
  1. ASKRDLM ;
  1. S DDXPOUT=0
  1. W !!,"You can choose a delimiter to be placed between output records.",!,"Enter <RET> to use no delimiter",!,"Enter '^' to stop the creation of an EXPORT template.",!
  1. S DIR(0)=".44,2" D ^DIR K DIR
  1. I $D(DUOUT)!$D(DTOUT) S DDXPOUT=1 Q
  1. S:X="@" Y=X S DDXPRDLM=Y
  1. Q
  1. GETOUT ;To see if user wants to continue.
  1. S DDXPOUT=0
  1. W "Do you want to continue?"
  1. S DIR(0)="Y",DIR("B")="YES"
  1. S DIR("?")="If you do not give this information, an EXPORT template will NOT be created."
  1. D ^DIR K DIR I $D(DIRUT)!'Y S DDXPOUT=1 Q
  1. W !!
  1. Q