Youmustspecifyatleastone-keyfieldorspecifythe-allkeysoption.Terms initalictypefaceare option stringsyousupply.Whenyouroptionstringcontainsa spaceora tabcharacter,youmustencloseitin singlequotes.
changeapply
-key input_field_name [-cs | ci] [-asc | -desc][-nulls first | last] [param params]
[-key inpt_field_name [-cs | ci] [-asc | -desc] -nulls first | last][param params ...]
| -allkeys [-cs | ci] [-asc | -desc] [-nulls first | last][param params]
[-allvalues [-cs | ci] [-param params]]
[-codeField field_name]
[-copyCode n]
[-collation_sequence locale | collation_file_pathname | OFF]
[-deleteCode n ] [-doStats]
[-dropkey input_field_name ...]
[-dropvalue input_field_name ...]
[-editCode n]
[-ignoreDeleteValues]
[-insertCode n]
[-value inpt_field_name [-ci | -cs] [param params] ...]
Note: The-checkSort optionhasbeen deprecated.Bydefault,partitionerandsortcomponentsare now insertedautomatically.
Option Use
-key -keyinput_field_name[-cs|ci][-asc|-desc][-nullsfirst
|last][-paramparams][-keyinput_field_name[-cs|ci]
[-asc|-desc][-nullsfirst|last][-paramparams]...]
Specifyoneormorekeyfields.
Youmustspecifyatleastonekeyforthisoptionor specifythe-allkeysoption.Theseoptionsaremutually exclusive.Youcannotuseavector,subrecord,ortagged aggregatefieldasavaluekey.
The-cisuboptionspecifiesthatthecomparisonofvalue keysiscaseinsensitive.The-cssuboptionspecifiesa case-sensitivecomparison,whichisthedefault.
-ascand-descspecifyascendingordescendingsort order.
-nullsfirst|lastspecifiesthepositionofnulls.
The-paramssuboptionallowsyoutospecifyextra parametersforakey.Specifyparametersusingproperty
=valuepairsseparatedbycommas.
-allkeys -allkeys[-cs|ci][-asc|-desc][-nullsfirst|last]
[-paramparams]
Specifythatallfieldsnotexplicitlydeclaredarekey fields.Thesuboptionsarethesameasthesuboptions describedforthe-keyoptionabove.
Youmustspecifyeitherthe-allkeysoptionorthe-key option.Theyaremutuallyexclusive.
-allvalues -allvalues[-cs|ci][-paramparams]
Specifythatallfieldsnototherwiseexplicitlydeclared arevaluefields.
The-cisuboptionspecifiesthatthecomparisonofvalue keysiscaseinsensitive.The-cssuboptionspecifiesa case-sensitivecomparison,whichisthedefault.
The-paramsuboptionallowsyoutospecifyextra parametersforakey.Specifyparametersusing property=valuepairsseparatedbycommas.
The-allvaluesoptionismutuallyexclusivewiththe -valueand-allkeysoptions.
-codeField -codeFieldfield_name
Thenameofthechangecodefield.Thedefaultis change_code.Thisshouldmatchthefieldnameusedin changecapture.
Option Use
-collation_sequence -collation_sequencelocale|collation_file_pathname|OFF Thisoptiondetermineshowyourstringdataissorted.
Youcan:
v SpecifyapredefinedIBMICUlocale.
v WriteyourowncollationsequenceusingICUsyntax, andsupplyitscollation_file_pathname.
v SpecifyOFFsothatstringcomparisonsaremade usingUnicodecode-pointvalueorder,independentof anylocaleorcustomsequence.
Bydefault,WebSphereDataStagesortsstringsusing byte-wisecomparisons.
Formoreinformation,referencethisIBMICUsite:
http://oss.software.ibm.com/icu/userguide/
Collate_Intro.html
-copyCode -copyCoden
Specifiesthevalueforthechange_codefieldinthe changerecordforthecopyresult.Thenvalueisanint8.
Thedefaultvalueis0.
Acopyrecordmeansthatthebeforerecordshouldbe copiedtotheoutputwithoutmodification.
-deleteCode -deleteCoden
Specifiesthevalueforthechange_codefieldinthe changerecordforthedeleteresult.Thenvalueisan int8.Thedefaultvalueis2.
Adeleterecordmeansthatarecordinthebeforedataset mustbedeletedtoproducetheafterdataset.
-doStats -doStats
Configurestheoperatortodisplayresultinformation containingthenumberofinputrecordsandthenumber ofcopy,delete,edit,andinsertrecords.
-dropkey -dropkeyinput_field_name
Optionallyspecifythatthefieldisnotakeyfield.Ifyou specifythisoption,youmustalsospecifythe-allkeys option.
Therecanbeanynumberofoccurrencesofthisoption.
-dropvalue -dropvalueinput_field_name
Optionallyspecifythatthefieldisnotavaluefield.If youspecifythisoption,youmustalsospecifythe -allvaluesoption.
Therecanbeanynumberofoccurrencesofthisoption.
Option Use
-editCode -editCoden
Specifiesthevalueforthechange_codefieldinthe changerecordfortheeditresult.Thenvalueisanint8.
Thedefaultvalueis3.
Aneditrecordmeansthatthevaluefieldsinthebefore datasetmustbeeditedtoproducetheafterdataset.
-ignoreDeleteValues -ignoreDeleteValues
Donotcheckvaluefieldsondeletes.Normally,
changeapplycomparesthevaluefieldsofdeletechange recordstothoseinthebeforerecordtoensurethatitis deletingthecorrectrecord.The-ignoreDeleteValues optionturnsoffthisbehavior.
-insertCode -insertCoden
Specifiesthevalueforthechange_codefieldinthe outputrecordfortheinsertresult.Thenvalueisanint8.
Thedefaultvalueis1.
Aninsertmeansthatarecordmustbeinsertedintothe beforedatasettoreproducetheafterdataset.
-value -valuefield[-ci|-cs][paramparams]
Optionallyspecifiesthenameofavaluefield.The-value optionmayberepeatediftherearemultiplevaluefields.
Thevaluefieldsaremodifiedbyeditrecords,andcanbe usedtoensurethatthecorrectrecordisdeletedwhen keysarenotunique.
Notethatyoucannotuseavector,subrecord,ortagged aggregatefieldasavaluekey.
The-cisuboptionspecifiesthatthecomparisonofvalues iscaseinsensitive.The-cssuboptionspecifiesa
case-sensitivecomparison,whichisthedefault.
The-paramssuboptionallowsyoutospecifyextra parametersforakey.Specifyparametersusing property=valuepairsseparatedbycommas.
The-valueand-allvaluesoptionsaremutuallyexclusive.
Example
Thisexampleassumesthattheinputdatasetrecordscontaincustomer,month,and balancefields.The operationexaminesthecustomer andmonthfieldsofeachinputrecord fordifferences.Bydefault, WebSphereDataStageinsertspartitionandsort componentstomeetthepartitioningandsortingneedsof thechangeapplyoperatorand otheroperators.
Hereisthedataflowdiagramfor theexample:
hash
tsort
copy
hash
tsort
changecapture
changeapply
schema:
customer:int16;
month:string[3];
name:string[21];
accounttype:int8 balance:sfloat;
key
value
before after
after data set
Hereistheoshcommand:
$ osh "hash -key month -key customer < beforeRaw.ds |
tsort -key month -key customer | copy > before_capture.v >
before_apply.v;
hash -key month -key customer < afterRaw.ds |
tsort -key month -key customer > after.v;
changecapture -key month -key customer -value balance <
before_capture.v < after.v > change.v;
changeapply -key month -key customer -value balance <
before_apply.v < change.v > after.ds"