#New: 28.01.2016 16:17:09
#Autor J.Fes
------------------------------------------------------------------------------------
JS:[10K.10-Intract1] JobServer:[WCAD112128:14000] [V3.12305 (Build:22.01.2016) (c) Dipl.Ing. J.Feuerstein 2005..2016]
-------------------------------------------------------------------- [28.01.2016 20:42:12] --
Datarow details of......: Job Scripts and Parameters:
Script.Name.............: TCPurgeDatasetsM1Keep1
JobScriptDescription....: Purge Datasets via Items -//- Keep=1
JC.Refile.Param.........:
JC.Script(cmd)..........: TCPurgeDatasets\ClientScripts\TCPurgeDatasets.cmd
JC.Script(cmd).ParamExt.: rem #Doc:using defines used Methode
                          set purge_datasets_via_methode=M1_Use_Tool_Purge_Datasets

                          rem #Doc:defines DS-Keep limit
                          set purge_datasets_keep=1
Note....................:
-------------------------------------------------------------------- [17.03.2016 09:32:38] --
Datarow details of......: Job Scripts and Parameters:
Script.Name.............: TCPurgeDatasetsM2Keep1
JobScriptDescription....: Purge Datasets via Datasets -//- Keep=1
JC.Refile.Param.........:
JC.Script(cmd)..........: TCPurgeDatasets\ClientScripts\TCPurgeDatasets.cmd
JC.Script(cmd).ParamExt.:
rem #Doc:using defines used Methode
set purge_datasets_via_methode=M2_use_Tcpb_Purge_Dataset

rem #Doc:defines DS-Keep limit
set purge_datasets_keep=1
Note....................: new:28.01.2016
-------------------------------------------------------------------- [17.03.2016 09:32:42] --
Datarow details of......: Job Scripts and Parameters:
Script.Name.............: TCPurgeDatasetsM2Keep2
JobScriptDescription....: Purge Datasets via Datasets -//- Keep=2
JC.Refile.Param.........:
JC.Script(cmd)..........: TCPurgeDatasets\ClientScripts\TCPurgeDatasets.cmd
JC.Script(cmd).ParamExt.: rem #Doc:using defines used Methode
                          set purge_datasets_via_methode=M2_use_Tcpb_Purge_Dataset

                          rem #Doc:defines DS-Keep limit
                          set purge_datasets_keep=2




################################################################################
################################################################################

-------------------------------------------------------------------- [28.01.2016 20:43:04] --
Datarow details of.............: JobControl Rules:
J.Order........................: 1-Rf00.03
J.JobName......................: RfTCPurgeDatasetsM2K1
J.Description..................: Rf TC Purge Datasets // via M2 Datases // Keep = 1
J.Aktiv........................: True
J.on Computers.................: WTCAD130034:5:N;WTCAD112227:5:N
J.Script/Para..................: TCPurgeDatasetsM2Keep1
J.Packet size..................: 100
J.Nr.Last......................: 142
J.Sum Obj.send.................: 10662
PGr:...........................: ProcStateCol15
sel:O.(DS/IR)..................: DS (DataSets)
sel:O.(SP/AP)..................: SP (Single parts)
sel.O.Type(s)..................: *
sel:O.MaxComp..................: 6000
sel:O.MultiS.Obj...............: SiteObj.Only
sel:O.SQL ScriptYN.............: True
sel:O.SQL Script File..........: RfTCPurgeDatasetsM2V2.sql
P.Stat(N,M,A)..................: RUN.K1
Note...........................: New:[28.01.16 15:19]/by:[srv_jobmanager]
                                 Change Info:
                                 -
sel:O.Status...................:
J.Packet Max.Sum(Ap.Count).....: 0
sel:O.Only Diffr.Items.........: False
sel.O.Spec.Rule................: NOT in Use (Default)
sel.O.Spec.Rule.Type(s)........:
sel.O.Spec.Rule.State..........:
sel.O.Spec.Rule.additonal.Data.: NOT in Use (Default)

-------------
Selection SQL:
SELECT TOP #JobObjectsN#
 Objects_tbl.*,
 Ir.ObjectPuid AS IrPuid,
 Ir.ObjectName AS IrName
FROM
 dbo.Objects_tbl WITH (nolock)
 LEFT OUTER JOIN dbo.Objects_Ir_Rel_tbl WITH (nolock) ON (dbo.Objects_tbl.Id = dbo.Objects_Ir_Rel_tbl.ObjectId)
 LEFT OUTER JOIN dbo.Objects_tbl Ir WITH (nolock) ON (dbo.Objects_Ir_Rel_tbl.IrId = Ir.Id)
WHERE
 Objects_tbl.ObjectClass='DS'
 AND Objects_tbl.ProcStateCol15 = 'N'
 AND Objects_tbl.ProcStateCol20 like 'D.%OK'
 AND Objects_tbl.ObjectOwningSiteID='#TcSiteId#'
 AND Objects_tbl.ObjectUgMaster_Type = 'SP'
 AND Objects_tbl.ObjectIrLatestRank<=-2
-- ORDER BY
--  Objects_tbl.ObjectLastModDate DESC



################################################################################
################################################################################
################################################################################
Usage: tcpb_purge_dataset [-u=-p=-g=] [-preserve_modification] [-input=] [-log=] [-h]

-u                     = Login User (needs -u/-p/-g or none)
-p                     = Login Password (needs -u/-p/-g or none)
-g                     = Login Group (needs -u/-p/-g or none)
-preserve_modification = Avoid change of last_modified (user & date)
-input                 =<inputfile>
-log                   =<logfile>
-h                     = Prints out this message

Must be able to give bypass rights to the User!

Format of input file lines: <Item-ID>@<Rev-ID>@<Dataset-Name>@<Dataset-Type>
                      E.g.:  1-170-31-03-028@00@1-170-31-03-028/00@UGMASTER
