Concantenate Records In Dfsort
Posted: Fri Jan 01, 2010 3:28 pm Post subject: use of icetool to concatenate records from different files Hi, i have fil1 with record length 260 and file2 with record length 200.requirement id to compare the records from both the files based on data in different position (like file1-1,10 and file2 111-10 should match). Concatenating ISPF libraries. There are also a bunch of links to IBM doc in here this time.) Some libraries are used by both TSO/ISPF and native TSO. This includes some basic load libraries (loadlibs) containing programs in executable format (e.g., load modules), such as might be found on a STEPLIB DD statement in the TSO Logon JCL procedure. DFSORT – Merge two files using SORT. If the first set of data is not sorted, your JOB shall abend with S000 U0016. To resolve this abend – make sure your 1st set of data is sorted. Lets say, we have below records for 1st set. They are employee name, employee salary and employee department.
I have a 6 row input file which consists of a field(Position 1 to 6) that contains a different value on every line. Based on the different values contained in this field the other fields (From position 7 -80) will be moved to to a single row in output.
E.G.
Input:
Output:
I need to find out how to read these all in as different rows and then output to a single row. I've tried using something similar to the code to this:
But this will move the data onto the correct position on seperate rows like this:
So now I think I need to do a sort in one step and a merge in another step. I would prefer to do it in one if it's possible however. I'd appreciate any help on this. Thanks.
cschneid1 Answer
You add a sequence-number to each record.
The use WHEN=GROUP to copy data from one record to one or more subsequent records.
You use OUTFIL INLUDE= to just pick up the final record.
You need to do a bit of planning. The sixth record will contain all the data, but perhaps not yet in the order that you want. Either with an IFTHEN=(WHEN=(logical expression) (to identify the sixth record) on the INREC or with the BUILD on the OUTREC, you can do your final formatting.
You need to change the something
each time, it will be receivingposition:sourceposition,length
Concantenate Records In Dfsort 5
The DFSORT manuals are very good, there is a Getting Started for those new to the product, and everything you'll ever need is in the Application Programming Guide,
Bill WoodgerBill WoodgerNot the answer you're looking for? Browse other questions tagged mergemainframejcldfsort or ask your own question.
- Other names that can be used to invoke SORT are ICEMAN,IERRCO00,IGHRCOOO and SYNCSORT.
- Sorting can be done from ISPF prompt also. For this open the file to be sorted in edit mode. Then use the command 'SORT 1 22' to sort the file from 1st to 22nd characters.
- DFSORT is invoked using JCL.
- Signals the initiation of a job. JOB statement contains all normal parameters as in normal JCL.
- Signals the initiation of a step. Tells OS which program is to be executed. For DFSORT the program to be executed is SORT.
- //STEPNAME EXEC PGM=SORT
- Defines the output dataset for messages.
- Defines the input dataset that needs to be sorted. Input Could be sequential, extended sequential, PDSE member, PDS member or a VSAM dataset. Files can be concatenated if the RECFM is the same for all files. For variable length files the file with largest record length must be first.
- Used for merge request input files . Up to 100 SORTINnn DD's may be specified. The 'nn' suffix can be any number in the range 00 thru 99; they may be skipped or used out of order. The files must already be sorted in the proper sequence for the MERGE.
- From 1 to 100 sort work files can be allocated using the SORTWKnn DD statement. The 'nn' suffix can be any number in the range 00 thru 99.SORTWKnn DD's are not used for a MERGE or a copy operation, or if the DYNALLOC parmis used. Each SORTWKnn MUST be on one unit & one volume.
- Defines the output dataset. It can be sequential, extended sequential data set ,a PDS member or a PDSE member.
- Output file for a SORT, MERGE, or copy function. Up to 100 SORTOFnn DD's may be specified. The 'nn' suffix can be any number in the range 00 through 99. They may be skipped or used out of order. The FNAMES/FILES parameter on the OUTFILE control statement specifies the DD names of the output files and the output records that are written to each SORTOFnn data set.
- Output file for a SORT or MERGE function. The records eliminated by SUM processing are written to the SORTXSUM DD.
- Defines the sort cards.
- Sorting data:
- EBCDIC character: CH
- ASCII character: AC
- BINARY : BI (COMP fields)
- ZONED Decimal: ZD (numeric fields with USAGE as display)
- Packed Decimal : PD (COMP-3)
- Alternate Sequence: AQ
- Merging datasets:
- Datasets should have same LRECL and RECFM
- Datasets should be sorted prior to Merge.
- Processing Order of control statements:
- INCLUDE /OMIT
- INREC Statement
- SORT/MERGE
- OUTREC Statement
- Copying datasets:
- INCLUDE Statement:
- COND=ALL means all input records are to be included.
- COND=NONE means none of the input records are to be included.
- AND may be specified as &. OR may be specified as ¦.
- OMIT statement:
- SUMming fields:
- Eliminating duplicates on a field:
- Reformatting output:
- Delete fields
- Reorder fields
- Insert strings or blanks
- Convert data to hexadecimal representation.
- Convert case.
- Edit numeric values
- Convert numeric values to another format.
- Perform arithmetic operations.
- Insert sequence number.
- Change record Length.
- The first field begins in byte 1 of the input record and is 20 bytes long.
- The second field begins in byte 40 of the input record and is a 15-byte ZD field.
- The third field begins in byte 60 of the input record and is 5 bytes long.
- Delete or repeat segments of the input records.
- Insert character strings between data fields.
- Insert binary zeros.
- Create a sequence number field.
- Convert numeric data to printable format or to another numeric data format.
- Perform arithmetic operations (multiply, divide, add, subtract) and minimum and maximum functions with numeric fields and constants.
- Convert data to printable hexadecimal format.Select, realign, and reorder data fields.
- Convert a variable length record input file to a fixed length record output file.
- Create multiple output files:
- Use the Sort Writer facility:
- Reformatting records: This task uses these parameters: OUTREC.
- Deleting a field:
- Reordering the fields:
- Insert a new field with zeros:
- Inserting Blanks:
- Creating multiple copies of same dataset:
- Selecting records to different files with STARTREC and ENDREC options
- Separating records to different files based upon record contents:
- BUILD command:
- SPLIT
- Editing Numeric values: