)CLEAR
)WSID SF2VX5

     .DL DEF_ CHECKLOG;R;Q;Q1;LQ
[1]   " SCALER   0 RETURNED IF ERROR OCCURED
[2]   " MATRIX OF .IO0 RETURNED IF NO ERRORS OCCURED AND NO DEFINITIONS
[3]   " WERE ENCOUNTERED.
[4]   " OTHERWISE A MATRIX OF LOGICAL DEFINITIONS
[5]   " IS RETURNED.
[6]   "
[7]   " ASSIGN FILENAME TO CHANNEL 3
[8]   DEF _ .IO0
[9]   .BXSINK _ .BXASS '3 ',AREA,L,'/AS'
[10]  " CHECK IF ERROR OCCURED WHILE READING FROM FILE
[11] C0:R _ .EP '  .IQ[8]3 '
[12]  .GO (0 = 1^.ROR)/C3
[13]  " CHECK IF A DEFINITION LINE HAS BEEN FOUND
[14]  .GO (&/'"*REPLACD BY' .EP R)/C1
[15]  .GO C2
[16]  " DEFINITION FOUND, INFORM USER
[17] C1: .GO (11 = .RO R)/C2
[18]  .GO ('REPLACED BY' &.= R[.IO11])/C1A
[19]  R _ (R.IO' ').DA R .DM .GO C1
[20] C1A:R _ 6^13.DAR
[21]  'THE LOGICAL ',R,' NEEDS TO BE DEFINED FOR FILE ',AREA,L
[22] C1B:LQ_.RO.QQ_'EQUIVALENCE NAME?:[<CR> IF NONE ] '
[23]  Q _ .QQ .DM Q _ LQ.DAQ
[24]  .GO (0=.ROQ)/C2
[25]  'THE LOGICAL ',R,' WILL BE DEFINED AS ',Q
[26]  Q _ R,' ',((Q .NE ' ')/Q),.BXCTRL[14],.BXCTRL[11]
[27]  DEF _ DEF,Q
[28]  " CHECK IF END OF DEFINITION SEGMENT
[29] C2: .GO ( 'W.BX' .OR.= 1^R )/C4
[30]  .GOC0
[31]  " ERROR ENCOUNTERED INFORM USER AND EXIT
[32] C3 :'THE FOLLOWING FILE WILL NOT BE INCLUDED '
[33]  'ENCOUNTERED  ERROR WHILE READING ',AREA,L
[34]  (.BXBOX .BXERROR )[1;] .DM ' '
[35]    DEF _ 0 .DM .GOC5
[36] C4: DEF _ .BXBOX DEF
[37]  C5: .BXDAS 3 .DM .GO0
     .DL
     .DLERROR ;P
[1]  E:'INVALID STRING IS IGNORED :',L
[2]   D _ 1 0 .DA D   .DM L _ ,(1,1.DA.ROD)^D
[3]   .GO (0=1^.ROD)/0
[4]   .GO (' '&.=L)/0
[5]   .GO ('-'.EPL)/E
[6]   .GO (L[1] = '%')/E
[7]   P _ L.IO' '
[8]   .GO (' '.OR..NEP.DAL)/E
[9]   .GO0
     .DL
     .DL FINDFILE ;I;R
[1]  F1:I_0
[2]   "     GENERATE A SUBNNN . COM FILE NAME
[3]  F2: NAME _ (NAME .NE ' ')/NAME_'SUB',(,'ZI3'.BXFMT I),'. COM'
[4]   "    OPEN FILE FOR INPUT TO SEE IF IT EXISTS
[5]   .BXSINK_.BXASS '2',NAME,'/AS'
[6]    R_.EP'.IQ[3]2'
[7]   "    IF IT EXISTS DROP AND INCREMENT I, OTHERWISE FILE IS GOOD
[8]    .GO(0 1 &.=.ROR)/F3
[9]    .GO(1000>I_I+1)/F2
[10]   .BXBREAK 'SUB000. COM THRU 999 IN USE'
[11]   .GO F1
[12] F3:.BXCLS 2
[13]   ('$! BUILDING ',(.BXASS 2),' ',.FM.BXTS).OQ[2]2
[14]  '$ DEFINE TT SYS$OUTPUT' .OQ[2]2
[15]  '$SET NOON' .OQ[2]2
[16]  ' ' .DM 'BUILDING DCL FILE ',NAME,' *** ' .DM ' '.DM .GO0
     .DL
     .DLSUBMIT ;D;AREA;NAME;R;T;P;L;C
[1]              "
[2]              "	THIS PROGRAM ACCEPTS A VALID VMS DIRECTORY SPECIFICATION
[3]              " ,AND GENERATES A DCL FILE THAT AUTOMATICALLY INVOKES VAX
[4]              " APL AND CONVERTS THE FILES SELECTED BY THE DIRECTORY SPEC.
[5]              " (THESE FILES ARE ASSUMED TO HAVE BEEN PRODUCED BY THE
[6]              " MIGRATE FUNCTION, AND ORIGINATED FROM AN APLSF ENVIRONMENT)
[7]              "
[8]              " IT INVOKES THE SYSTEM COMMAND )LIB TO OBTAIN THE LIST OF
[9]              " SELECTED FILES.
[10]            "
[11]            " IT ASSUMES THAT THE LIST TO BE OF THE FOLLOWING FORMAT :
[12]            "
[13]            "		DIRECTORY    'SPECIFICATION'
[14]            "		<CRLF>
[15]            "		<CRLF>
[16]            "		'FILENAME'
[17]            "		'FILENAME'
[18]            "		.
[19]            "		.
[20]            "		.
[21]            "		'FILENAME'
[22]            "		<CRLF>
[23]            "		TOTAL OF N FILES.
[24]            "
[25]            " (THERE CAN BE SEVERAL OF THESE FOLLOWING ONE AFTER THE OTHER)
[26]            " (IF MORE THAN ONE DIRECTORY IS SPECIFIED, THE LISTING ENDS -
[27]            "  WITH :
[28]            "          GRAND TOTAL OF N FILES.	)
[29]            "
[30]            " IT CALLS A FUNCTION ERROR , THAT SKIPS OVER INVALID LINES
[31]            " IE: ERROR MESSAGES PRODUCED BY VMS DUE TO INCORRECT DIRECTORY
[32]            " SPECIFICATIONS.
[33]            " INVALID TEXT IS DISPLAYED ON THE TERMINAL TO INFORM THE USER
[34]            " OF THE NATURE OF THE ERROR.
[35]            "
[36]  		"
[37]  		" IT ALSO CALLS A FUNCTION FINDFILE, THAT SEARCHES THE USER'S
[38]  		" DIRECTORY FOR AN UNUSED FILENAME SUBNNN. COM AND ASSIGNS
[39]  		" THE FILE TO CHANNEL 2 FOR OUTPUT. THIS FILE WILL CONTAIN THE
[40]           " DCL COMMANDS TO SUBMIT TO BATCH.
[41]  		"
[42]           " IT ALSO CALSS THE FUNCTION CHECKLOG, WHICH CHECKS TO
[43]           " MAKE SURE IF ANY OF THE INPUT SCRIPT FILES TO BE EXECUTED
[44]           " WILL REQUIRE LOGICALS TO BE DEFINED. IF YES , THE USER
[45]           " IS INFORMED.
[46]            " NOTE:
[47]           "  THIS PROGRAM WILL NOT GENERATE A DCL FILE IF THERE IS A SYNTAX
[48]           "  ERROR IN THE DIRECTORY SPECIFICATION.
[49]           "  THIS PROGRAM WILL GENERATE A PARTIAL FILE IF MULTIPLE
[50]           "  DIRECTORIES ARE SPECIFIED, AND ONE OR MORE OF THESE
[51]           "  SPECIFICATIONS ADDRESS A NON-EXISTANT AREA OR THE USER HAS
[52]           "  INSUFFICIENT PRIVELEGES TO ACCESS THIS AREA.
[53]           "
[54]           " *****BEGIN*******
[55]           "
[56]           "
[57]           "
[58]           .QQ _ 'ENTER FILE NAMES TO BE INCLUDED :[*.*;*] ' .DM AREA _ .QQ
[59]           "
[60]           " OPEN DCL FILE SUBNNN. COM , AND ASSIGN TO CHANNEL 2
[61]          FINDFILE
[62]         " GET DIRECTORY (NOTE THAT )LIB COULD GET AN ERROR)
[63]           D _ .BXBOX .EP ')LIB ',AREA
[64]           "
[65]          "
[66]          "	CHECK FOR DIRECTORY HEADER
[67]         S1:R_0 .DM L _ ,(1,1.DA.ROD)^D
[68]          .GO  ((('DIRECTORY'&.=9^L).OR('Directory'&.=9^L))&(('['.EPL).OR('<'.EPL)))/S3
[69]          " 	CHECK FOR BLANKS
[70]          .GO (' '&.=L )/S2
[71]          " 	CHECK FOR GRAND TOTAL TAILER
[72]          .GO (('GRAND'&.=5^L).OR('Grand'&.=5^L))/S8
[73]          .GO (0=1^.ROD)/S8
[74]          ERROR
[75]          .GO(0=1^.ROD)/S8   .DM .GOS1
[76]          "	SKIP BLANK LINES
[77]         S2: D _ 1 0 .DA D .DM .GOS1
[78]          "	GET NAME OF DIRECTORY
[79]         S3: AREA _ 10.DAL
[80]          AREA _ (AREA .NE ' ')/AREA
[81]          "	SKIP BLANK LINES
[82]         S4: D _ 1 0 .DA D .DM L _ ,(1,1.DA.ROD)^D
[83]          .GO (' '&.=L)/S4
[84]          "	WRITE RECORD TO . COM FILE
[85]         S5:
[86]          " CHECK FOR LOGICALS
[87]        L _ (L.NE' ')/L
[88]         C _ CHECKLOG
[89]         .GO (0=.RO.ROC)/S6
[90]          .BX _('$! INCLUDING  ',AREA,L).OQ[2]2   .DM ' '
[91]        S5A: .GO ( 0 = 1^.ROC)/S5B
[92]         ('$ DEFINE ',C[1;]).OQ [2] 2
[93]         C _ 1 0 .DA C  .DM .GOS5A
[94]         S5B:'$ APL/TERM=TTY/NOSILENT'.OQ[2]2
[95]          ')OUTPUT TT:/TTY'.OQ[2]2
[96]          ')MAXCORE 1500'.OQ[2]2
[97]          (')INPUT ',AREA,L,'/KEY').OQ[2]2
[98]          ')OFF HOLD'    .OQ[2]2
[99]       '$!   '.OQ[2]2
[100]         " GET NEXT LINE, AND CHECK FOR TOTAL , BLANK LINES ,
[101]       " AND ERROR MESSAGES.
[102]        S6: D _ 1 0 .DA D .DM L _ ,(1,1.DA.ROD)^D
[103]         .GO (('TOTAL'&.=5^L).OR('Total'&.=5^L))/S7
[104]         .GO(' '&.=L)/S6
[105]         .XQ (('-'.EPL).OR(L[1]='%'))/'ERROR'
[106]         P _ L.IO' '
[107]         .GO (' '&.=P.DAL)/S5
[108]        ERROR .DM .GOS5
[109]        "
[110]        "	CHECK IF END OF RECORDS
[111]       S7: D _ 1 0 .DA D
[112]        .GO (((1 0)/.ROD)=0)/S8
[113]        .GOS1
[114]        "
[115]        "	DONE
[116]      S8: '$ DEASSIGN TT '.OQ[2]2
[117]         .BXDAS 2 .DM 'DCL FILE ',NAME,'  COMPLETED *** '
     .DL

)SAVE
