This might be useful:
http://techsupport.information...cof/cof_tcn_018.htmlI'll not modify your code as it is a better learning situation if you do it yourself. However, I will provide an example from our Unix system.
Here is the no index master (I will leave out a bunch of the fields):
FILE=MPVELSUM, SUFFIX=FOC ,
DATASET=/data/bnsf/mp/mpvelsum.foc
SEGNAME=MPVELSUM, SEGTYPE=S0 ,$
FIELD=E_DATE ,ALIAS=E_DATE, FORMAT=A10 ,MISSING=ON ,$
FIELD=EDATE ,ALIAS=EDATE, FORMAT=D20.2 ,MISSING=ON ,$
FIELD=HP ,ALIAS=HP, FORMAT=D20.2 ,MISSING=ON ,$
FIELD=MILES ,ALIAS=MILES, FORMAT=D20.2 ,MISSING=ON ,$
FIELD=MEASTM ,ALIAS=MEASTM, FORMAT=D20.2 ,MISSING=ON ,$
Here is the indexed master:
FILE=MPVELSUM, SUFFIX=FOC ,
DATASET=/data/bnsf/mp/mpvelsum.foc
SEGNAME=MPVELSUM, SEGTYPE=S0 ,$
FIELD=E_DATE ,ALIAS=E_DATE, FORMAT=A10 ,MISSING=ON ,INDEX=I,$
FIELD=EDATE ,ALIAS=EDATE, FORMAT=D20.2 ,MISSING=ON ,$
FIELD=HP ,ALIAS=HP, FORMAT=D20.2 ,MISSING=ON ,$
FIELD=MILES ,ALIAS=MILES, FORMAT=D20.2 ,MISSING=ON ,$
FIELD=MEASTM ,ALIAS=MEASTM, FORMAT=D20.2 ,MISSING=ON ,$
FIELD=UTLTM ,ALIAS=UTLTM, FORMAT=D20.2 ,MISSING=ON ,$
Notice that they both point to the same data base. You will not need the DATASET parameter as you will use the DYNAM command.
You will need a 3rd master which is the one that is named the same as your file:
FILE=MPVELSUM, SUFFIX=FOC ,
DATASET=/data/bnsf/mp/mpvelsum.foc
SEGNAME=MPVELSUM, SEGTYPE=S0 ,$
FIELD=E_DATE ,ALIAS=E_DATE, FORMAT=A10 ,MISSING=ON ,INDEX=I,$
FIELD=EDATE ,ALIAS=EDATE, FORMAT=D20.2 ,MISSING=ON ,$
FIELD=HP ,ALIAS=HP, FORMAT=D20.2 ,MISSING=ON ,$
FIELD=MILES ,ALIAS=MILES, FORMAT=D20.2 ,MISSING=ON ,$
FIELD=MEASTM ,ALIAS=MEASTM, FORMAT=D20.2 ,MISSING=ON ,$
FIELD=UTLTM ,ALIAS=UTLTM, FORMAT=D20.2 ,MISSING=ON ,$
Next there is a TABLE request to extract the data and put it in a hold file. I already showed that in my previous post. Here is the rest with annotation:
SET MESSAGE=OFF
SET REBUILDMSG = 0
TABLE FILE MPSAS_LOCO_VELOC_SMRY
PRINT
EDATE
HP
MILES
MEASTM
UTLTM
...
BY E_DATE
WHERE E_DATE GE whatever'
ON TABLE HOLD FORMAT ALPHA
END
-* Create the file with the master with indexes. This will leave a slot for the index in the root page of the DB.
CREATE FILE MPVELSUM
-* You may have to use DYNAM COPY to do this and the one below.
-* Copy the no index master to the true master.
APP COPYFILE mp_loco mpvelsum_noix MASTER mp_loco mpvelsum MASTER
-* Load the file with the no index master.
MODIFY FILE MPVELSUM
FIXFORM FROM HOLD
DATA ON HOLD
CHECK 5000
END
-RUN
-* Copy the index master to the true master
APP COPYFILE mp_loco mpvelsum_indx MASTER mp_loco mpvelsum MASTER
-* Do the REBUILD/INDEX
REBUILD
INDEX
MPVELSUM
*
-RUN
You may also need to use a USE statement to refer the master to the data base. You can look up that command.
Hope this helps.
Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google