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

AIBCVT0.m

Go to the documentation of this file.
AIBCVT0 ;IHS/DDPS/DFM-IBM STAT RECORDS CONTROL PARAMETERS [ 01/12/89  1:06 PM ]
 ;1.3; 1/13/89 CONTROLS FOR PARKLAWN AND NIH
 ;1.3; 9/23/88 RESTRUCTURE, ALLOW FOR REGISTRATION ELIGIBILITY FILE
 ;1.0; 3/28/88
CONTROL ;READ CONTROL GLOBAL TO DETERMINE SYSTEM AND FIELD CHARACTERISTICS
 K AIBC,AIBB S AIBCS="",AIBCS=$O(^AIBCVTC("C",""_AIBGBLP_"",AIBCS))
 G:$L(AIBCS)>0 CTLFOUND
 S AIBA="A",AIBMSG="No Control Global Entry for "_AIBGBLP
 D ERRMSG^AIBCVT6 G RETURN
CTLFOUND ;CONTROL GLOBAL FOUND FOR RECORDS SYSTEM
 S AIBCN1="",AIBCN2=0
 S AIBTGBL="",AIBTMP="",AIBTGLT="",AIBTGFT=""
 I $L(AIB2ND)=0 G NEWFILE
 I AIBCF=$P(^AIBCVTC(AIBCS,0),U,3)!((AIBFILE="ibmjob")&(AIBGBLP="AGEL")) S AIBT2="A" G CK2ND
NEWFILE ;CREATE A NEW OUTPUT FILE
 S AIBT2="W" S:'$D(AIBOK) AIBFFN=""
 I AIBOS="D"!('$D(AIBT1)) G CK2ND
 S AIBMSG="File Created : "_AIBT1 D ERRMSG^AIBCVT6
CK2ND ;CHECK IF TEMPORARY FILE FOR 2ND RECORD FORMAT IS NEEDED
 S AIB2ND=$P(^AIBCVTC(AIBCS,0),U,4)
 I $L(AIB2ND)=0 G GETNAME
 S AIBTGBL=$P(^AIBCVTC(AIB2ND,0),U,2),AIBTMP=U_AIBTGBL_"GLOB"
 S AIBTGLT=AIBTMP_"(AIBZ)",AIBTGFT=AIBTMP_"(AIBZ,AIBTZ)",AIBTZ(1)=0
GETNAME ;GET OUTPUT FILE NAME
 S AIBCNM=$P(^AIBCVTC(AIBCS,0),U,1)
 S AIBCN3=""
 I AIBGBLP="AGEL" I AIBFILE="ibmjob" G CTLOOPN
 S AIBCF=$P(^AIBCVTC(AIBCS,0),U,3)
CTLOOPN ;GET CONTROL FOR ALL NODES IN RECORD
 S AIBCN3=$O(^AIBCVTC(AIBCS,1,"C",AIBCN3)) G:AIBCN3="" CTLNDONE
 S AIBCN2=AIBCN2+1,AIBCF2=0,AIBCF3=""
 S AIBCN1="",AIBCN1=$O(^AIBCVTC(AIBCS,1,"C",AIBCN3,AIBCN1))
 S AIBC(AIBCN2)=^AIBCVTC(AIBCS,1,AIBCN1,0)
CTLOOPF ;GET CONTROL FOR ALL FIELDS IN NODE
 S AIBCF3=$O(^AIBCVTC(AIBCS,1,AIBCN1,1,"C",AIBCF3))
 I AIBCF3="" G CTLFDONE
 S AIBCF2=AIBCF2+1
 S AIBCF1="",AIBCF1=$O(^AIBCVTC(AIBCS,1,AIBCN1,1,"C",AIBCF3,AIBCF1))
 S AIBC(AIBCN1,AIBCF2)=^AIBCVTC(AIBCS,1,AIBCN1,1,AIBCF1,0) G CTLOOPF
CTLFDONE ;CONTROL FOR ALL FIELDS IN NODE LOADED
 S $P(AIBC(AIBCN2),U,3)=AIBCF2
 G CTLOOPN
CTLNDONE ;CONTROL FOR ALL NODES LOADED
 S AIBCL=$P(AIBC(AIBCN2,AIBCF2),U,2),AIBL=$P(AIBC(AIBCN2,AIBCF2),U,3)
 S AIBRLN=AIBCL+AIBL-1
 S AIBC(0)=AIBCN2 I AIBFILE="keytap" S AIBJ="" G RETURN
 D ^AIBCVT00 G:AIBA="A" RETURN
SETRJE ;SETUP TO GET RJE DATA
 S AIBB2=0,AIBB3=""
CTLOOPB ;GET CONTROL INFORMATION FOR RJE JOB BYSYNC TELECOMMUNICATIONS CARD
 S AIBB3=$O(^AIBCVTC(AIBCS,2,"C",AIBB3))
 I AIBB2=0 I AIBB3="" S AIBA="A",AIBMSG="No Control Global Entry for "_AIBGBLP_" RJE Cards" D ERRMSG^AIBCVT6 G RETURN
 I AIBB3="" G RETURN
 S AIBB2=AIBB2+1,AIBB1="",AIBB1=$O(^AIBCVTC(AIBCS,2,"C",AIBB3,AIBB1))
 S AIBB(AIBB2)=^AIBCVTC(AIBCS,2,AIBB1,0)
 G CTLOOPB
BJCL ;WRITE BEGINNING JCL FOR RJE BYSYNC JOB
 S AIBJ=0,AIBJC=$P(^AIBCVTC(AIBCS,0),U,5)
BJCLOOP ;WRITE NEXT BEGINNING JCL CARD
 S AIBJ=$O(^AIBCVTJ(AIBJC,1,AIBJ)) G:AIBJ="" RETURN
 S AIBOT=$P(^AIBCVTJ(AIBJC,1,AIBJ,0),U,2)
RESOLVE1 ;RESOLVE AREA CODES
 I AIBOT["|" S AIBOW=$P(AIBOT,"|",1),AIBTLN=$L(AIBOW)+2,AIBOW2=$E(AIBOT,AIBTLN,999),AIBOT=AIBOW_AIBJSAC_AIBOW2 G RESOLVE1
RESOLVE2 ;DDPS REMOTE NUMBER
 I AIBOT["~" S AIBOW=$P(AIBOT,"~",1),AIBTLN=$L(AIBOW)+2,AIBOW2=$E(AIBOT,AIBTLN,999),AIBOT=AIBOW_AIBJSRD_AIBOW2 G RESOLVE2
RESOLVE3 ;ACCOUNTING POINT
 I AIBOT["#" S AIBOW=$P(AIBOT,"#",1),AIBTLN=$L(AIBOW)+2,AIBOW2=$E(AIBOT,AIBTLN,999),AIBOT=AIBOW_AIBJSAP_AIBOW2 G RESOLVE3
RESOLVE4 ;AREA NAME
 I AIBOT["@" S AIBOW=$P(AIBOT,"@",1),AIBTLN=$L(AIBOW)+2,AIBOW2=$E(AIBOT,AIBTLN,999),AIBOT=AIBOW_AIBJSAN_AIBOW2 G RESOLVE4
RESOLVE5 ;PARKLAWN REMOTE NUMBER
 I AIBOT["`" S AIBOW=$P(AIBOT,"`",1),AIBTLN=$L(AIBOW)+2,AIBOW2=$E(AIBOT,AIBTLN,999),AIBOT=AIBOW_AIBJSRP_AIBOW2 G RESOLVE5
RESOLVE6 ;NIH REMOTE NUMBER
 I AIBOT["!" S AIBOW=$P(AIBOT,"!",1),AIBTLN=$L(AIBOW)+2,AIBOW2=$E(AIBOT,AIBTLN,999),AIBOT=AIBOW_AIBJSRN_AIBOW2 G RESOLVE6
 K AIBOW2,AIBTLN
 D WRITE^AIBCVT3 S AIBCTJ=AIBCTJ+1 G BJCLOOP
EJCL ;WRITE ENDING JCL FOR RJE BYSYNC JOB
 S AIBJ=0
EJCLOOP ;WRITE NEXT ENDING JCL CARD
 S AIBJ=$O(^AIBCVTJ(AIBJC,2,AIBJ)) G:AIBJ="" RETURN
 S AIBOT=$P(^AIBCVTJ(AIBJC,2,AIBJ,0),U,2)
 D WRITE^AIBCVT3 S AIBCTJ=AIBCTJ+1 G EJCLOOP
RETURN ;RETURN TO CALLING ROUTINE
 Q