outrec in sort jcl examples

Outreach in Sort JCL: Sample Code Examples

By Christopher Moore
AD

Understanding and implementing OUTREC in SORT JCL can seem complex, but with the right guidance and examples, it becomes quite manageable. OUTREC is a feature in JCL that allows you to control the output of sorted datasets. Let's delve into this topic, providing key examples along the way.

Before we dive into the examples, let's understand the basics. OUTREC is used to determine whether to keep or delete output records during a SORT operation. The default behavior of OUTREC is to keep (or 'O') all output records. However, with the help of specific options, we can control this behavior. Now, let's explore two main topics: controlling output records and deleting output records.

Controlling Output Records

In this section, we'll discuss how to control which output records are kept using OUTREC. By using the 'O' option with specific conditions, we can refine our output.

AD
Selection sort
Selection sort
“Outliers – The Data That Doesn’t Fit”
“Outliers – The Data That Doesn’t Fit”
an image of a screen shot of a web page with the word sort on it
an image of a screen shot of a web page with the word sort on it

The 'O' option allows us to specify conditions under which records should be output. For instance, 'O record' keeps a record if it matches the literal 'record'. Let's see an example:

Keeping Records That Match a Literal

Suppose we want to keep only the records that start with 'AA'. The JCL would look like this:

Algoritmo de ordenación
Algoritmo de ordenación
Outlier Detection Methods
Outlier Detection Methods
selection sort algorithm
selection sort algorithm
OUTREC O'AA '

This 'OUTREC' option will keep only the records that start with 'AA'.

Keeping Records Based on Conditions

We can also use more complex conditions to determine which records to keep. For instance, the 'O SYSPRINT' option keeps all records that go to the SYSPRINT, which is typically used for error messages.

AD

Deleting Output Records

Sometimes, we might want to delete certain output records. The 'D' option in OUTREC enables us to do this.

Julia's Reruns Bot (@b0rk_reruns@jvns.ca)
Julia's Reruns Bot (@b0rk_reruns@jvns.ca)
a diagram showing the sequence of different types of data
a diagram showing the sequence of different types of data
an instruction manual for selecting and using the selection sort in word to describe what it is
an instruction manual for selecting and using the selection sort in word to describe what it is
Sorting ArrayList in Java using Collections.sort() Method
Sorting ArrayList in Java using Collections.sort() Method
#Excel #Tips: How to do Custom Sort in Excel
#Excel #Tips: How to do Custom Sort in Excel
two vennuous circles with numbers in them and the same number on each one
two vennuous circles with numbers in them and the same number on each one

Let's consider a scenario where we want to delete all duplicate records in our dataset. Here's how we could do it:

Deleting Duplicate Records

The 'D DELETE' option deletes duplicate input records. Here's an example:

AD
OUTREC D DELETE '

This command will keep the first occurrence of a record and delete all subsequent duplicates.

Insertion Sort Algorithm | C Programming | Questions Bank
Insertion Sort Algorithm | C Programming | Questions Bank
an image of a diagram that shows the different jobs available for each job and how to use them
an image of a diagram that shows the different jobs available for each job and how to use them
Understanding the Algorithm behind Merge Sort for Linked Lists
Understanding the Algorithm behind Merge Sort for Linked Lists
a diagram showing how to use containers for containering and other things in the process
a diagram showing how to use containers for containering and other things in the process
a whiteboard with some diagrams on it that include numbers and an array of symbols
a whiteboard with some diagrams on it that include numbers and an array of symbols
an image of a diagram that shows the different types of data processing tools and how to use them
an image of a diagram that shows the different types of data processing tools and how to use them
SQL CTE Explained with Examples | Common Table Expression Tutorial
SQL CTE Explained with Examples | Common Table Expression Tutorial
📂 sort: Sort File Contents in Linux
📂 sort: Sort File Contents in Linux
a screenshot of a web page with the text section highlighted in red and white
a screenshot of a web page with the text section highlighted in red and white
a block diagram with the words,'logical cqrs'on it
a block diagram with the words,'logical cqrs'on it
Outlier
Outlier
inner join vs Left join
inner join vs Left join
Data Science Learning, Computer Coding, Study Notes, Data Science, Computer Science, Machine Learning, Helping People, Science, Engineering
Data Science Learning, Computer Coding, Study Notes, Data Science, Computer Science, Machine Learning, Helping People, Science, Engineering

Deleting Records Based on Conditions

We can also specify conditions for deletion, just like we did for keeping records. For example, 'D record' deletes a record if it matches the literal 'record'.

Incorporating OUTREC in SORT JCL isn't as daunting as it might initially seem. With the right understanding and the right examples, everyone can master this valuable feature. Now that you have a grasp of controlling and deleting output records, start experimenting with these examples in your own dataset. Happy coding!

AD
AD