Let's understand Mainframe
Home Tutorials Interview Q&A Quiz Mainframe Memes Contact us About us

Module 8: JCL Sort & Merge

OUTREC statement

OUTREC statement is used to reformat output dataset. In other words OUTREC statement is used to add, delete or to rearrange the fields of dataset after records are sorted, merged or copied.

For example, if input file Employee-Details contains fields EMP-NAME, EMP-DEPT, EMP-SALARY information and we want output file to be sorted based on EMP-NAME and after sort operation we want only EMP-DEPT and EMP-SALAYRY field to be written. This can be done using OUTREC statement

Using OUTREC we can accomplish tasks listed below:-

  • Delete or repeat segments or fields 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.

While using OUTREC, we can reformat the record using below parameters:-

  • IF THEN clauses

Each of them are explained in upcoming articles

© copyright mainframebug.com
Privacy Policy