A versatile dfhsort utility

Slides:



Advertisements
Similar presentations
REACH-CRC. Lookup Functions INDEX-MATCH LOOKUP Database Functions DSUM DMIN DMAX DCOUNT DAVERAGE.
Advertisements

CSCI 6962: Server-side Design and Programming Input Validation and Error Handling.
XP Chapter 3 Succeeding in Business with Microsoft Office Access 2003: A Problem-Solving Approach 1 Analyzing Data For Effective Decision Making.
Structured Query Language Part I Chapter Three CIS 218.
How to Program in C++ CHAPTER 3: INPUT & OUTPUT INSTRUCTOR: MOHAMMAD MOJADDAM.
Introduction to Structured Query Language (SQL)
Introduction to Query Part 2. Query Topics Joining Files Defining Result Fields Complex Record Selection Formatting Output Creating Reports Using Multiple.
Tutorial 5: Working with Excel Tables, PivotTables, and PivotCharts
Welcome to SAS…Session..!. What is SAS..! A Complete programming language with report formatting with statistical and mathematical capabilities.
Microsoft Access 2000 Creating Tables and Relationships.
Syntax MROUND(number,multiple) Number is the value to round. Multiple is the multiple to which you want to round number. Remark MROUND rounds up, away.
October 2003Bent Thomsen - FIT 3-21 IT – som værktøj Bent Thomsen Institut for Datalogi Aalborg Universitet.
1 Data List Spreadsheets or simple databases - a different use of Spreadsheets Bent Thomsen.
SAS Efficiency Techniques and Methods By Kelley Weston Sr. Statistical Programmer Quintiles.
A Simple Guide to Using SPSS ( Statistical Package for the Social Sciences) for Windows.
Database Applications – Microsoft Access Lesson 4 Working with Queries 36 Slides in Presentation.
XP. Objectives Sort data and filter data Summarize an Excel table Insert subtotals into a range of data Outline buttons to show or hide details Create.
INPUT / OUTPUT STATEMENTS
5 1 Data Files CGI/Perl Programming By Diane Zak.
Microsoft® Excel Key and format dates and times. 1 Use Date & Time functions. 2 Use date and time arithmetic. 3 Use the IF function. 4 Create.
Verification & Validation. Batch processing In a batch processing system, documents such as sales orders are collected into batches of typically 50 documents.
Sections 5.1 – 5.4 © Copyright by Pearson Education, Inc. All Rights Reserved.
Relational Database Techniques
Chapter 11 Data Validation. Question Should your program assume the data is correct, or should your program edit the data to ensure it is correct?
An Introduction to Programming with C++ Sixth Edition Chapter 13 Strings.
11- 1 Chapter 11.  Avoiding Logic Errors by Validating Input  What to Do If Input Errors Occur  Global Considerations in COBOL  When Data Should Be.
Uniq The uniq command is useful when you need to find duplicate lines in a file. The basic format of the command is uniq in_file out_file In this format,
An Introduction to Programming with C++ Sixth Edition Chapter 5 The Selection Structure.
Working Efficiently with Large SAS® Datasets Vishal Jain Senior Programmer.
Classification : Internal DFSORT Utility. Classification : Internal Overview DFSORT is IBM's high-performance product for z/OS. Following operations can.
Excel AVERAGEIF Function
Creating a database table
Excel STDEV.S Function.
IST 220 – Intro to Databases
Excel IF Function.
Excel Functions.
Tutorial 5: Working with Excel Tables, PivotTables, and PivotCharts
Microsoft Office Illustrated Introductory, Windows Vista Edition
Arrays: Checkboxes and Textareas
Data Validation and Protecting Workbook
Chapter 2 Assignment and Interactive Input
Inside Module 10 Editing TurboIMAGE Datasets Page
The Selection Structure
Building and Using Queries
Intro to PHP & Variables
Unit 42 : Spreadsheet Modelling
Recommended Budget Reductions
Chapter 18: Modifying SAS Data Sets and Tracking Changes
Database Queries.
MODULE 7 Microsoft Access 2010
Creating and Modifying Queries
Chapter 3 The DATA DIVISION.
Guide To UNIX Using Linux Third Edition
Iteration: Beyond the Basic PERFORM
Iteration: Beyond the Basic PERFORM
Chapter 3 Input output.
Computing in COBOL: The Arithmetic Verbs and Intrinsic Functions
Producing Descriptive Statistics
CHAPTER 17 The Report Writer Module
Data Management – Processing
Inside Module 8 Extracting Data Page Using the Extract command 2
JavaScript: Introduction to Scripting
Bent Thomsen Institut for Datalogi Aalborg Universitet
Microsoft Office Illustrated Introductory, Windows XP Edition
Shelly Cashman: Microsoft Access 2016
Lesson 13 Working with Tables
Upload/Download Inventory
Upload/Download Inventory
Decision Making Using the IF and EVALUATE Statements
Presentation transcript:

A versatile dfhsort utility ICETOOL A versatile dfhsort utility

ICETOOL definition ICETOOL allows to perform multiple operations on one or more data sets in a single job step. It supports 13 operations as below: COPY COUNT DEFAULTS DISPLAY MODE OCCUR RANGE SELECT SORT SPLICE STATS UNIQUE VERIFY

copy . Copies a data set to one or more output data sets. Syntax COPY FROM(indd) TO(outdd,...) USING(xxxx) VSAMTYPE(x) LOCALE(name) SERIAL LOCALE(CURRENT) LOCALE(NONE) Examples COPY FROM(IN1) TO(NEW,BACKUP) USING(CTL1) COPY FROM(VSAMIN) TO(VSAMOUT) VSAMTYPE(V) COPY FROM(MASTER) USING(OUTF) CTL1CNTL might contain the following: //CTL1CNTL DD OMIT COND=(28,5,PD,NE,NUM) / Optional Operands VSAMTYPE - the record format for a VSAM input data set (F or V). LOCALE - overrides the installation default for locale processing. SERIAL - causes OUTFIL processing not to be used for multiple outdd data sets. SERIAL is not recommended because it imposes data set restrictions and can degrade performance .

Example1: To copy data from input to output file //TESTJCL JOB (KUMA),,CLASS=S,MSGLEVEL=(1,1),MSGCLASS=R, // NOTIFY=&SYSUID //******************************************************************* //STEP01 EXEC PGM=ICETOOL //IN DD DSN=KUMAR.TEST.FILE,DISP=SHR //OUT DD DSN=KUMAR.TEST.FILE.BKP,DISP=(NEW,CATLG,DELETE), // DCB=(RECFM=FB,LRECL=273),SPACE=(CYL,(10,10),RLSE) //TOOLMSG DD SYSOUT=* //DFSMSG DD SYSOUT=* //TOOLIN DD * COPY FROM(IN) TO(OUT) /*

Example2: To copy data from input to two output files with the date condition, which start from position 20 //TESTJCL JOB (KUMA),,CLASS=S,MSGLEVEL=(1,1),MSGCLASS=R, //******************************************************************* //STEP01 EXEC PGM=ICETOOL //INDD DD DSN=KUMAR.TEST.FILE,DISP=SHR //OUTDD DD DSN=KUMAR.TEST.FILE.DT24,DISP=(NEW,CATLG,DELETE), // DCB=(RECFM=FB,LRECL=273),SPACE=(CYL,(10,10),RLSE) //OUTDD1 DD DSN=KUMAR.TEST.FILE.DT26,DISP=(NEW,CATLG,DELETE), //TOOLMSG DD SYSOUT=* //DFSMSG DD SYSOUT=* //TOOLIN DD * COPY FROM(INDD) TO(OUTDD) USING(CTL1) COPY FROM(INDD) TO(OUTDD1) USING(CTL2) /* //CTL1CNTL DD * INCLUDE COND=(20,10,CH,EQ,'03/24/2012') //CTL2CNTL DD * INCLUDE COND=(20,10,CH,EQ,'03/26/2012')

Count Prints a message in TOOLMSG containing the count of records in a data set. Can also be used to set RC=12 or RC=0 based on the count of records in a dataset. Syntax COUNT FROM(indd) USING(xxxx) VSAMTYPE(x) LOCALE(name) LOCALE(CURRENT) LOCALE(NONE) EMPTY RC4 NOTEMPTY HIGHER(x) LOWER(y) EQUAL(v) NOTEQUAL(w)

Example: Count the records in the input file: //TESTJCL JOB (DVBP),,CLASS=S,MSGLEVEL=(1,1),MSGCLASS=R, // NOTIFY=&SYSUID //*********************************************************** //STEP01 EXEC PGM=ICETOOL //INDD DD DSN=KUMAR.TEST.FILE,DISP=SHR //TOOLMSG DD SYSOUT=* //DFSMSG DD SYSOUT=* //TOOLIN DD * COUNT FROM(INDD) /* After the job run: TOOLMSG will show the COUNT:

Example: Check the empty file: //TESTJCL JOB (DVBP),,CLASS=S,MSGLEVEL=(1,1),MSGCLASS=R, // NOTIFY=&SYSUID //*********************************************************** //STEP01 EXEC PGM=ICETOOL //INDD DD DSN=KUMAR.TEST.FILE,DISP=SHR //TOOLMSG DD SYSOUT=* //DFSMSG DD SYSOUT=* //TOOLIN DD * COUNT FROM(INDD) EMPTY RC4 /* RC4 – If file is empty the job will give maxcc=4 After the job run: TOOLMSG will show the report as below: EMPTY, NOTEMPTY, HIGHER, LOWER, EQUAL, NOTEQUAL - defines the criteria against which the record count is to be matched. If the criteria is met, ICETOOL sets RC=12 for this COUNT operator by default, or RC=4 if RC4 is specified. If the criteria is not met, ICETOOL sets RC=0 for this COUNT operator. x, y, v, and w must be specified as n or +n where n can be 0 to 562949953421310. for example: COUNT FROM(MASTER) HIGHER(5) RC4 RC4 - sets RC=4 if the criteria is met (overriding the default of RC=12).

DISPLAY Prints the values and characters of specific numeric and character fields in a separate list data set. Simple, tailored or sectioned reports can be produced. Syntax: DISPLAY FROM(INDD) LIST(OUTDD) BLANK - TITLE(‘TITLE NAME') PAGE DATE TIME - HEADER('RECORD-TYPE1') ON(p,l,fm) - HEADER(‘RECORD-TYPE2') ON(p,l,fm) Where p – position, l-length and fm is format like CH,ZD,PD and etc.

Example: Print a file with its header like below: //TESTJCL JOB (DVBP),,CLASS=S,MSGLEVEL=(1,1),MSGCLASS=R, // NOTIFY=&SYSUID //**************************************************************** //STEP01 EXEC PGM=ICETOOL //INDD DD DSN=KUMAR.TEST.FILE,DISP=SHR //OUTDD DD SYSOUT=* //TOOLMSG DD SYSOUT=* //DFSMSG DD SYSOUT=* //TOOLIN DD * DISPLAY FROM(INDD) LIST(OUTDD) BLANK - TITLE(‘INPUT FILE') PAGE DATE TIME - HEADER('RECORD-TYPE') ON(1,1,CH) – HEADER(‘ITEM-ID') ON(2,4,ZD) -

HEADER('REF-NBR') ON(10,40,CH) – HEADER('FACE-AMT') ON(68,6,PD,C1) - HEADER('FEE-AMT') ON(74,4,PD,C1) – TOTAL('TOTAL AMOUNT:') /* Where C1 is a mask for NUM values for editing the value for 2 decimal points and minus signs. TOTAL : it will give the calculation of every numeric field.

OCCUR Prints each unique value for specified numeric and character fields and how many times it occurs in a separate list data set. Simple or tailored reports can be produced. The values printed can be limited to those for which the value meets specified criteria (e.g. only duplicate values). Syntax: OCCUR FROM(SOURCE) LIST(VOLSERS) ON(4,6,CH) ON(VALCNT) OCCUR FROM(FAILURES) LIST(CHECKIT) LISTNOSDB - DATE(YMD.) TITLE('Possible System Intruders') PAGE - HEADER(' Userid ') ON(23,8,CH) - HEADER(' Logon Failures ') ON(VALCNT) - HIGHER(4) BLANK

Example: To print the count of a record in the input file Example: To print the count of a record in the input file. //TESTJCL JOB (DVBP),,CLASS=S,MSGLEVEL=(1,1),MSGCLASS=R, // NOTIFY=&SYSUID //********************************************************************* //STEP01 EXEC PGM=ICETOOL //INDD DD DSN=KUMAR.TEST.FILE,DISP=SHR //OUTDD DD SYSOUT=* //TOOLMSG DD SYSOUT=* //DFSMSG DD SYSOUT=* //TOOLIN DD * OCCUR FROM(INDD) LIST(OUTDD) BLANK - TITLE(‘ITEM-NBR INFO') PAGE DATE TIME - HEADER(‘ITEM-NBR') ON(10,40,CH) - HEADER('TTL CNT') ON(VALCNT) /* HIGHER(2) : for getting the values greater than 2. For multiple keys: OCCUR FROM(INDD) LIST(OUTDD) BLANK - TITLE('MASTER FILE') PAGE DATE TIME - ON(1,30,CH) - ON(38,13,CH) - ON(70,40,CH) - ON(VALCNT)

RANGE Prints a message in TOOLMSG containing the count of values in a specified range for a specific numeric field. The range can be specified as higher than x, lower than y, higher than x and lower than y, equal to v, or not equal to w, where x, y, v, and w are signed or unsigned decimal values. Syntax RANGE FROM(indd) ON(p,m,f) HIGHER(x) VSAMTYPE(x) ON(VLEN) LOWER(y) EQUAL(v) NOTEQUAL(w) Examples RANGE FROM(DATA1) ON(VLEN) HIGHER(52) RANGE FROM(DATA2) ON(31,18,ZD) EQUAL(-12345678912345678) RANGE FROM(DATA2) ON(25,3,PD) HIGHER(-2) LOWER(+15)

select Selects records from the indd data set for inclusion in the outdd data set based on meeting criteria for the number of times specified numeric and/or character field values occur. From 1 to 10 ON fields can be specified. All ON fields are used to determine the value count (that is, the number of times the ON values occur) to be matched against the criteria. Different Matching Criteria: FIRST - keep only the first record for each value (that is, records with non-duplicate values, and the first record for duplicate values) FIRST(n) - keep only |the first n records for each value (that is, records with non-duplicate |values, and the first n records for duplicate values) LAST - keep only the last record for each value (that is, records with non-duplicate values, and the last record for duplicate values) FIRSTDUP - only keep the first record for duplicate values FIRSTDUP(n) - only keep the |first n records for duplicate values LASTDUP - only keep the last record for duplicate values ALLDUPS - only keep records with duplicate values NODUPS - only keep records with non-duplicate values EQUAL(n) - only keep records |with values that occur n times HIGHER(n) - only keep records |with values that occur more than n times LOWER(n) - only keep records |with values that occur less than n times

Example: To copy all the records of any cart ref-id having records more than 2. //TOOLIN DD * SELECT FROM(INDD) TO(OUTDD) - ON(70,40,CH) HIGHER(2) /* Exampe: To copy all the records having multiple records and item-nbr EQ 12345678. ON(70,40,CH) HIGHER(2) USING(CNT1) //CNT1CNTL DD * INCLUDE COND=(41,10,ZD,EQ,8753264)

sort Sorts the indd data set to the outdd data sets (up to 10) using the the DFSORT control statements in xxxxCNTL. You must supply a DFSORT SORT statement in xxxxCNTL to indicate the control fields for the sort. Additional DFSORT control statements and options can be used to sort a subset of the input records (INCLUDE or OMIT statement; SKIPREC and STOPAFT options; OUTFIL INCLUDE, OMIT, SAVE, STARTREC, ENDREC, SAMPLE, SPLIT, SPLITBY and SPLIT1R operands), reformat records for output (INREC, OUTREC and OUTFIL statements), and so on. Syntax SORT FROM(indd) USING(xxxx) TO(outdd,...) VSAMTYPE(x) LOCALE(name) SERIAL LOCALE(CURRENT) LOCALE(NONE)

Example: SORT FROM(A) TO(B,C,D) USING(DEPT) DEPTCNTL might contain the following: //DEPTCNTL DD SORT FIELDS=(15,3,A,27,4,D),FORMAT=PD INREC OVERLAY=(22:5,8,SQZ=(SHIFT=LEFT)) / SORT FROM(MASTER) USING(MULT) MULTCNTL might contain the following: //MULTCNTL DD SORT FIELDS=(18,3,ZD,A,43,2,BI,D) OUTFIL FNAMES=DEPT1,INCLUDE=(5,3,CH,EQ,C'D1') OUTFIL FNAMES=DEPT2,INCLUDE=(5,3,CH,EQ,C'D2') OUTFIL FNAMES=DEPT3,INCLUDE=(5,3,CH,EQ,C'D3') OUTFIL FNAMES=REST,SAVE

splice ICETOOL's SPLICE operator can be use to create output records in a variety of ways by splicing together up to 50 fields from records that have the same ON field values, but different information. The output records are sorted by the ON field values. The records to be spliced can originate from different input data sets, making it possible to perform various "join" and "match" operations. We can use up to 10 ON fields; all of the ON field values are used for sorting and splicing. For example, if you use ON(1,4,CH), 'ABCD+01' and 'ABCD-01' are sorted in that order (by 1,4,CH,A) and counted as two occurrences of 'ABCD'. However, if you use ON(1,4,CH) and ON(5,3,FS), 'ABCD-01' is sorted before 'ABCD+01' (by 1,4,CH,A and 5,3,FS,A) and counted as one occurrence of 'ABCD-01' and one occurrence of 'ABCD+01'. To do a join or match operation on two input data sets, we need to have the fields aligned appropriately for each pair of records to be spliced. Typically, we accomplish that by copying and reformatting one or both input data sets to temporary data sets, so we can splice the temporary data sets together.

Syntax: SPLICE FROM(indd) TO(outdd) ON(p,m,f). WITH(p,m) Syntax: SPLICE FROM(indd) TO(outdd) ON(p,m,f) ... WITH(p,m) ... WITHEACH KEEPNODUPS KEEPBASE VSAMTYPE(x) UZERO USING(xxxx) WITHALL VLENMAX VLENOVLY Example: SPLICE FROM(CON1) TO(OUT1) ON(11,8,CH) ON(3,44,CH) WITH(1,1) SPLICE FROM(CON1) TO(OUT2) ON(11,8,CH) - WITHALL WITH(51,5) WITH(11,75) - KEEPNODUPS USING(CTL1) SPLICE FROM(CON2) TO(OUT3) ON(15,5,ZD) - WITHEACH WITH(21,2) WITH(41,2) WITH(61,2)

Example1: To match two files and copied the matched record into an output file: //TESTJCL JOB (DVBP),,CLASS=S,MSGLEVEL=(1,1),MSGCLASS=R, // NOTIFY=&SYSUID //********************************************************************* //STEP01 EXEC PGM=ICETOOL //INDD DD DSN=KUMAR.TEST.INPUT.FILE1,DISP=SHR //INDD1 DD DSN=KUMAR.TEST.INPUT.FILE2,DISP=SHR //TEMP DD DSN=&&TEMP,DISP=(MOD,PASS),UNIT=SYSDA, // SPACE=(CYL,(5,5),RLSE) //MATCH DD DSN=KUMAR.TEST.MATCHED,DISP=(,CATLG,DELETE), // SPACE=(CYL,(5,5),RLSE),DCB=(LRECL=500,RECFM=FB) //TOOLMSG DD SYSOUT=* //DFSMSG DD SYSOUT=* //TOOLIN DD * COPY FROM(INDD) TO(TEMP) COPY FROM(INDD1) TO(TEMP) SPLICE FROM(TEMP) TO(MATCH) - ON(50,9,CH) - ON(10,40,CH) - ON(01,2,CH) - ON(03,2,CH) - ON(05,5,CH) - ON(104,11,CH) - ON(115,10,CH) WITH(1,500) - /* Note: MATCH file will contain the record of second file; Swap the order of COPY control card for getting the first file record instead of second record. For getting the record from both file use KEEPBASE option; And for getting the matched and unmatched record both use KEEPNODUPS

Example2: get the matched record and unmatched records from different files: //TESTJCL JOB (KUMAR),,CLASS=S,MSGLEVEL=(1,1),MSGCLASS=R, // NOTIFY=&SYSUID //********************************************************************* //STEP01 EXEC PGM=ICETOOL //INDD DD DSN=KUMAR.TEST.INPUT.FILE1,DISP=SHR //INDD1 DD DSN=KUMAR.TEST.INPUT.FILE2,DISP=SHR //TEMP DD DSN=&&TEMP,DISP=(MOD,PASS),UNIT=SYSDA, // SPACE=(CYL,(5,5),RLSE) //MATCH DD DSN=KUMAR.TEST.MATCHED,DISP=(,CATLG,DELETE), // SPACE=(CYL,(5,5),RLSE),DCB=(LRECL=500,RECFM=FB) //UNMATCH DD DSN=KUMAR.TEST.UNMATCHD,DISP=(,CATLG,DELETE), //TOOLMSG DD SYSOUT=* //DFSMSG DD SYSOUT=* //TOOLIN DD * COPY FROM(INDD) TO(TEMP) COPY FROM(INDD1) TO(TEMP) SPLICE FROM(TEMP) TO(MATCH) ON(50,9,CH) ON(10,40,CH) ON(01,2,CH) ON(03,2,CH) - ON(05,5,CH) ON(104,11,CH) ON(115,10,CH) WITH(1,500) SELECT FROM(TEMP) TO(UNMATCH) ON(50,9,CH) ON(10,40,CH) ON(01,2,CH) ON(03,2,CH) - ON(05,5,CH) ON(104,11,CH) ON(115,10,CH) NODUPS /*

STATS Prints messages in TOOLMSG containing the minimum, maximum, average and total for up to 10 specified numeric fields. The average is calculated by dividing the total by the record count and rounding down to the nearest integer. Syntax STATS FROM(indd) ON(p,m,f) VSAMTYPE(x) LMSG ON(VLEN) Examples STATS FROM(DATA1) ON(VLEN) ON(15,4,ZD) STATS FROM(VSAMIN) ON(5,8,BI) ON(2,2,PD) ON(12,6,FS) ON(47,3,FI) - VSAMTYPE(F)

Example1:

unique Prints a message in TOOLMSG containing the count of unique values for a specified numeric or character field. Syntax UNIQUE FROM(indd) ON(p,m,f) VSAMTYPE(x) UZERO ON(VLEN) Examples UNIQUE FROM(INPUT) ON(2,4,CH) UNIQUE FROM(DATA) ON(5,3,ZD)

verify Examines up to 10 specified decimal fields in a data set and prints a message in TOOLMSG identifying each invalid value found for each field. A decimal value is considered invalid under one of the following circumstances: it contains A-F as a digit (example: a PD field of 00AF) it contains 0-9 as a sign and the NOSIGN operand is not specified (example: a ZD field of F235). Syntax VERIFY FROM(indd) ON(p,m,f) NOSIGN LIMIT(n) VSAMTYPE(x) Examples VERIFY FROM(NEW) ON(22,16,PD) ON(7,9,PD) VERIFY FROM(DATA) ON(28,5,PD) ON(28,18,ZD) ON(4,7,PD) - NOSIGN LIMIT(1)

Return Code 0 - Successful completion. No errors were detected. 4 - Successful completion. DFSORT detected one or more warning conditions. 12 - Unsuccessful completion. ICETOOL detected one or more errors. Can also be set if the record count meets a specified criteria (for example, a data set is empty, or a data set contains more than 50000 records). 16 - Unsuccessful completion. DFSORT detected one or more errors. 20 - Message data set error. The TOOLMSG DD statement was not present or the TOOLMSG data set was not opened. 24 - Unsupported operating system. The operating system was not z/OS or OS/390.