syncsort command on unix

来源:互联网 发布:mac 扫描局域网ip 编辑:程序博客网 时间:2024/05/02 16:17


General Command Line


$ syncsort SyncsortOptions

$ syncsort /INSERT syncsort.script


For example:

$ syncsort /INSERT syncsort.script /STATISTICS /END


syncsort.script is collect of syncsort options:

/INFILE DATA.IN SEQUENTIAL MFLINESEQUENTIAL 20/PADBYTE X"20"/FIELDS FLD_CH_1_END 3 CH 2/KEYS  FLD_CH_1_END ASCENDING/STABLE/OUTFILE DATA.OUT SEQUENTIAL MFLINESEQUENTIAL 20 OVERWRITE


Notice:

1. Options in script are case-insensitive

2. comment in script is /* comment content */



Common Option

/COPY

To specify that SyncSort is to perform a copy (rather than a sort, join, or merge).


The /COPY option will not change the order of the records.The number

of output records will be the same as the number of input records


For Example:

DATA.IN1:

11CCcc1122AAaa2233BBbb3344XXxx44


DATA.IN2:

11CCccCC22AAaaAA33BBbbBB44XXxxAA


SORT.SCRIPT:

/INFILE DATA.IN1 SEQUENTIAL MFLINESEQUENTIAL 20/INFILE DATA.IN2 SEQUENTIAL MFLINESEQUENTIAL 20/COPY/OUTFILE DATA.OUT SEQUENTIAL MFLINESEQUENTIAL 20 OVERWRITE


DATA.OUT:

11CCcc1122AAaa2233BBbb3344XXxx4411CCccCC22AAaaAA33BBbbBB44XXxxAA


/MERGE

To specify that SyncSort is to perform a merge (rather than a sort, join, or copy).


Compared with /COPY option, the /MERGE option will merge input records in sorted data.


For Example:


SORT.SCRIPT:

/INFILE DATA.IN1 SEQUENTIAL MFLINESEQUENTIAL 20/INFILE DATA.IN2 SEQUENTIAL MFLINESEQUENTIAL 20/MERGE/OUTFILE DATA.OUT SEQUENTIAL MFLINESEQUENTIAL 20 OVERWRITE


DATA.OUT

11CCcc1111CCccCC22AAaa2222AAaaAA33BBbb3333BBbbBB44XXxx4444XXxxAA


(Since there is no merge field is specified; the default merge field is used. But I really don't know how merge fields are used; as I tested, fields can work fine with sort option, but not with merge option.)

/INFILE

To define a file as a source of input records.


Format:

    /INFILE file_attribute record_limit


For Example:

    /infile sort1.in fixed 80

    /infile sort.in ":"


/OUTFILE

To specify a file as a destination of output records.

Format:

    /OUTFILE file_identifier [file_qual …]


For Example:

    /outfile sort1.out fixed 80


/INCLUDE

To select records for processing or for an output destination.


Format:

    /include condition


/OMIT

To omit records from further processing or from an output destination.

Format:

    /omit condition


/FIELDS

To describe the layout(s) of the input records in terms of named positional or

delimited fields.


Format:

    /fields name start type length, ...


For Example:

    /fields cust_id 3 integer 4, cust_name 7 character 40

    /fields po_number 1 char 10, item_code 15 char 5, num_ordered 23 int 2


/KEY

To specify the key fields used for ordering the input records.


Format:

    /key fieldname [ASCENDING|DESCENDING]


For Example:

    /key volume_id

    /keys state ascending, county ascending, amount descending

    /keys cust_id, trans_date desc, trans_amount


/PADBYTE

To specify the value of the character for padding short records and keys.

Format:

    /PADBYTE "a"|X"xx"|O"ooo"


For Example:

    /padbyte " "

    /padbyte x"20"



/INSERT

To augment an application definition with text contained in a file.



/STABLE

To indicate that the order of equal-keyed records is to be maintained.


/STATISTICS

To request statistics concerning SyncSort's execution.



0 0
原创粉丝点击