SlideShare a Scribd company logo
1 of 20
www.srinimf.com
1
I am giving here only sysin code so that you can get
quick refresh:
Y4T = YYYYMMDD
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC BUILD=(1,8,Y4T,TOJUL=Y4T)
/*
We converted to Julian date YYYYDDD
2
OPTION COPY
OUTREC OVERLAY=(30:16,8,Y4T,TOGREG=Y2T)
OUTFIL INCLUDE=(30,1,CH,EQ,C'*'),BUILD=(1,25)
Wherever ‘*’ is there in date starting position. Those records
we can get in the output.
3
//SYSIN DD *
OPTION COPY
INREC OVERLAY=(20:1,8,Y4T,DATEDIFF,10,8,Y4T)
/*
 Output contains différence between dates.
4
// SET INPVAR1='BBDY1'
// SET INPVAR2='BBJOB'
the following DFSORT symbols would be built in
SYMNAMES:
the INCLUDE statement would be transformed to:
INCLUDE
COND=(8,5,CH,EQ,C'BBDY1',OR,8,5,CH,EQ,C'BBJOB'
)
5
//SYSIN DD *
OPTION COPY
OUTFIL FNAMES=OUT1,INCLUDE=(1,4,CH,EQ,C'1010'),ACCEPT=100
OUTFIL FNAMES=OUT2,INCLUDE=(1,4,CH,EQ,C'1020'),ACCEPT=100
OUTFIL FNAMES=OUT3,INCLUDE=(1,4,CH,EQ,C'1030'),ACCEPT=100
OUTFIL FNAMES=OUT4,INCLUDE=(1,4,CH,EQ,C'1040'),ACCEPT=100
/*
This trick we use to split input record into 4
outfiles.
6
OUTREC OVERLAY=(51:51,100,TRAN=ETOA,
301:301,40,TRAN=ETOA)
7
//JK1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//IN1 DD DSN=... file 1
//IN2 DD DSN=... file 2
//OUT DD DSN=... output file
//SYSIN DD *
JOINKEYS F1=IN1,FIELDS=(1,3,A),SORTED
JOINKEYS F2=IN2,FIELDS=(1,3,A),SORTED
REFORMAT FIELDS=(F1:1,9,F2:5,5)
OPTION COPY
OUTFIL FNAMES=OUT,BUILD=(1,9,X,10,5)
/*
File A
000 $$$$$
File B
001 BBBBB
Output
001 AAAAA BBBBB
8
//JK2 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//IN1 DD DSN=... input file1 (FB/18)
//IN2 DD DSN=... input file2 (FB/22)
//OUT DD DSN=... output file (FB/27)
//SYSIN DD *
JOINKEYS F1=IN1,FIELDS=(12,4,A,3,9,A)
JOINKEYS F2=IN2,FIELDS=(1,4,A,6,9,A)
REFORMAT FIELDS=(F2:1,22,F1:1,1,17,2)
OPTION COPY
OUTFIL FNAMES=OUT,BUILD=(1,22,X,23,1,X,24,2)
/*
9
//CJ EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//IN1 DD DSN=... input fileA (FB/30)
//IN2 DD DSN=... input fileB (FB/16)
//SORTOUT DD DSN=... output file (FB/36)
//SYSIN DD *
JOINKEYS F1=IN1,FIELDS=(1,10,A)
JOINKEYS F2=IN2,FIELDS=(1,10,A)
REFORMAT FIELDS=(F2:1,16,F1:11,20)
OPTION COPY
/*
10
//JK2 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//IN1 DD DSN=... input file1 (FB/25)
//IN2 DD DSN=... input file2 (FB/15)
//SORTOUT DD DSN=... output file (FB/15)
//SYSIN DD *
JOINKEYS F1=IN1,FIELDS=(7,9,A)
JOINKEYS F2=IN2,FIELDS=(1,9,A)
REFORMAT FIELDS=(F2:1,15)
OPTION COPY
/*
=> Now the data is from File2
11
//SYSIN DD *
JOINKEYS F1=IN1,FIELDS=(7,9,A)
JOINKEYS F2=IN2,FIELDS=(1,9,A)
JOIN UNPAIRED,F1,ONLY
OPTION COPY
/*
12
//JK4 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//IN1 DD DSN=... input file1 (VB)
//IN2 DD DSN=... input file2 (VB)
//SORTOUT DD DSN=... output file (VB)
//SYSIN DD *
JOINKEYS F1=IN1,FIELDS=(11,9,A)
JOINKEYS F2=IN2,FIELDS=(5,9,A)
JOIN UNPAIRED,F1,ONLY
OPTION COPY
/*
13
//JK5 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//IN1 DD DSN=... input File1 (FB/10)
//IN2 DD DSN=... input File2 (FB/10)
//OUT12 DD SYSOUT=* names in File1 and File2
//OUT1 DD SYSOUT=* names in File1 only
//OUT2 DD SYSOUT=* names in File2 only
//SYSIN DD *
JOINKEYS F1=IN1,FIELDS=(1,10,A)
JOINKEYS F2=IN2,FIELDS=(1,10,A)
JOIN UNPAIRED,F1,F2
REFORMAT FIELDS=(F1:1,10,F2:1,10,?)
OPTION COPY
OUTFIL FNAMES=OUT12,INCLUDE=(21,1,CH,EQ,C'B'),
BUILD=(1,10)
OUTFIL FNAMES=OUT1,INCLUDE=(21,1,CH,EQ,C'1'),
BUILD=(1,10)
OUTFIL FNAMES=OUT2,INCLUDE=(21,1,CH,EQ,C'2'),
BUILD=(11,10)
/*
14
OUTFIL FNAMES=FBVB1,FTOV
OUTFIL
FNAMES=FBVB2,FTOV,BUILD=(1,10,C'=',21,10)
15
SUM FIELDS=NONE,XSUM
SUM FIELDS=NONE => it will not keep
duplicates. It will remove duplicate records.
16
http://srinimf.com/2012/04/26/jcl-sort-pd-to-
zd-with-length-calculation/
17
These will be used for report generation purpose.
Some shops use SORT, and others use Easytrieve.
Just go through reference section. These are
commonly asked questions in Interviews.
18
ftp://ftp.software.ibm.com/storage/dfsort/m
vs/sorttrck.pdf
19
20
Thank You
www.srinimf.com

More Related Content

What's hot

Jcl tutor
Jcl tutorJcl tutor
Jcl tutor
shivas
 
Mainframe JCL Part - 1
Mainframe JCL Part - 1Mainframe JCL Part - 1
Mainframe JCL Part - 1
janaki ram
 
Mainframe jcl exec and dd statements part - 3
Mainframe jcl exec and dd statements part - 3Mainframe jcl exec and dd statements part - 3
Mainframe jcl exec and dd statements part - 3
janaki ram
 

What's hot (20)

Skillwise JCL
Skillwise JCLSkillwise JCL
Skillwise JCL
 
Introduction of ISPF
Introduction of ISPFIntroduction of ISPF
Introduction of ISPF
 
JCL FOR FRESHERS
JCL FOR FRESHERSJCL FOR FRESHERS
JCL FOR FRESHERS
 
Jcl faqs
Jcl faqsJcl faqs
Jcl faqs
 
TSO Productivity
TSO ProductivityTSO Productivity
TSO Productivity
 
Jcl tutor
Jcl tutorJcl tutor
Jcl tutor
 
Z4R: Intro to Storage and DFSMS for z/OS
Z4R: Intro to Storage and DFSMS for z/OSZ4R: Intro to Storage and DFSMS for z/OS
Z4R: Intro to Storage and DFSMS for z/OS
 
SKILLWISE-DB2 DBA
SKILLWISE-DB2 DBASKILLWISE-DB2 DBA
SKILLWISE-DB2 DBA
 
DB2 utilities
DB2 utilitiesDB2 utilities
DB2 utilities
 
JCL SORT TOOL
JCL SORT TOOLJCL SORT TOOL
JCL SORT TOOL
 
Mainframe JCL Part - 1
Mainframe JCL Part - 1Mainframe JCL Part - 1
Mainframe JCL Part - 1
 
JCL DFSORT
JCL DFSORTJCL DFSORT
JCL DFSORT
 
Jcl
JclJcl
Jcl
 
JCL MAINFRAMES
JCL MAINFRAMESJCL MAINFRAMES
JCL MAINFRAMES
 
DB2 on Mainframe
DB2 on MainframeDB2 on Mainframe
DB2 on Mainframe
 
Practical Recipes for Daily DBA Activities using DB2 9 and 10 for z/OS
Practical Recipes for Daily DBA Activities using DB2 9 and 10 for z/OSPractical Recipes for Daily DBA Activities using DB2 9 and 10 for z/OS
Practical Recipes for Daily DBA Activities using DB2 9 and 10 for z/OS
 
Cobol
CobolCobol
Cobol
 
Mainframe jcl exec and dd statements part - 3
Mainframe jcl exec and dd statements part - 3Mainframe jcl exec and dd statements part - 3
Mainframe jcl exec and dd statements part - 3
 
MVS ABEND CODES
MVS ABEND CODESMVS ABEND CODES
MVS ABEND CODES
 
Icetool
IcetoolIcetool
Icetool
 

Viewers also liked (10)

IMSDB-COBOL PROGRAM EXPLANATION
IMSDB-COBOL PROGRAM EXPLANATIONIMSDB-COBOL PROGRAM EXPLANATION
IMSDB-COBOL PROGRAM EXPLANATION
 
100 sql queries
100 sql queries100 sql queries
100 sql queries
 
Cobol questions and answers
Cobol questions and answersCobol questions and answers
Cobol questions and answers
 
Cobol interview-questions
Cobol interview-questionsCobol interview-questions
Cobol interview-questions
 
Top 9 mainframe testing interview questions answers
Top 9 mainframe testing interview questions answersTop 9 mainframe testing interview questions answers
Top 9 mainframe testing interview questions answers
 
IMSDB - DBRC
IMSDB - DBRCIMSDB - DBRC
IMSDB - DBRC
 
Some ISPF Tricks
Some ISPF TricksSome ISPF Tricks
Some ISPF Tricks
 
Basic IMS For Applications
Basic IMS For ApplicationsBasic IMS For Applications
Basic IMS For Applications
 
White Paper, The Basics Of Data Security
White Paper, The Basics Of Data SecurityWhite Paper, The Basics Of Data Security
White Paper, The Basics Of Data Security
 
UVP, Mine
UVP, MineUVP, Mine
UVP, Mine
 

Similar to 20 DFSORT Tricks For Zos Users - Interview Questions

import java.util.Scanner;public class Fraction {   instan.pdf
import java.util.Scanner;public class Fraction {    instan.pdfimport java.util.Scanner;public class Fraction {    instan.pdf
import java.util.Scanner;public class Fraction {   instan.pdf
apleathers
 
(381877808) 102054282 5-listing-program
(381877808) 102054282 5-listing-program(381877808) 102054282 5-listing-program
(381877808) 102054282 5-listing-program
Dimz I
 
Write a program that works with fractions. You are first to implemen.pdf
Write a program that works with fractions. You are first to implemen.pdfWrite a program that works with fractions. You are first to implemen.pdf
Write a program that works with fractions. You are first to implemen.pdf
leventhalbrad49439
 
Interfacepackage PJ1; public interface SimpleFractionInterface.pdf
Interfacepackage PJ1; public interface SimpleFractionInterface.pdfInterfacepackage PJ1; public interface SimpleFractionInterface.pdf
Interfacepackage PJ1; public interface SimpleFractionInterface.pdf
sutharbharat59
 
The following is the (incomplete) header file for the class Fracti.pdf
The following is the (incomplete) header file for the class Fracti.pdfThe following is the (incomplete) header file for the class Fracti.pdf
The following is the (incomplete) header file for the class Fracti.pdf
4babies2010
 
Combine the keypad and LCD codes in compliance to the following requ.pdf
Combine the keypad and LCD codes in compliance to the following requ.pdfCombine the keypad and LCD codes in compliance to the following requ.pdf
Combine the keypad and LCD codes in compliance to the following requ.pdf
forwardcom41
 
DiceSimulatorProgram
DiceSimulatorProgramDiceSimulatorProgram
DiceSimulatorProgram
Amy Baxter
 

Similar to 20 DFSORT Tricks For Zos Users - Interview Questions (16)

Let’s talk about microbenchmarking
Let’s talk about microbenchmarkingLet’s talk about microbenchmarking
Let’s talk about microbenchmarking
 
Sort presentation
Sort presentationSort presentation
Sort presentation
 
import java.util.Scanner;public class Fraction {   instan.pdf
import java.util.Scanner;public class Fraction {    instan.pdfimport java.util.Scanner;public class Fraction {    instan.pdf
import java.util.Scanner;public class Fraction {   instan.pdf
 
(381877808) 102054282 5-listing-program
(381877808) 102054282 5-listing-program(381877808) 102054282 5-listing-program
(381877808) 102054282 5-listing-program
 
Write a program that works with fractions. You are first to implemen.pdf
Write a program that works with fractions. You are first to implemen.pdfWrite a program that works with fractions. You are first to implemen.pdf
Write a program that works with fractions. You are first to implemen.pdf
 
M.TECH 1ST SEM COMPUTER SCIENCE AOS LAB PRGMS 2014
M.TECH 1ST SEM COMPUTER SCIENCE AOS LAB PRGMS 2014M.TECH 1ST SEM COMPUTER SCIENCE AOS LAB PRGMS 2014
M.TECH 1ST SEM COMPUTER SCIENCE AOS LAB PRGMS 2014
 
#include stdafx.h using namespace std; #include stdlib.h.docx
#include stdafx.h using namespace std; #include stdlib.h.docx#include stdafx.h using namespace std; #include stdlib.h.docx
#include stdafx.h using namespace std; #include stdlib.h.docx
 
Interfacepackage PJ1; public interface SimpleFractionInterface.pdf
Interfacepackage PJ1; public interface SimpleFractionInterface.pdfInterfacepackage PJ1; public interface SimpleFractionInterface.pdf
Interfacepackage PJ1; public interface SimpleFractionInterface.pdf
 
The following is the (incomplete) header file for the class Fracti.pdf
The following is the (incomplete) header file for the class Fracti.pdfThe following is the (incomplete) header file for the class Fracti.pdf
The following is the (incomplete) header file for the class Fracti.pdf
 
Sysprog17
Sysprog17Sysprog17
Sysprog17
 
System programs in C language.
System programs in C language.System programs in C language.
System programs in C language.
 
TilePUzzle class Anderson, Franceschi public class TilePu.docx
 TilePUzzle class Anderson, Franceschi public class TilePu.docx TilePUzzle class Anderson, Franceschi public class TilePu.docx
TilePUzzle class Anderson, Franceschi public class TilePu.docx
 
Combine the keypad and LCD codes in compliance to the following requ.pdf
Combine the keypad and LCD codes in compliance to the following requ.pdfCombine the keypad and LCD codes in compliance to the following requ.pdf
Combine the keypad and LCD codes in compliance to the following requ.pdf
 
C++ Question on References and Function Overloading
C++ Question on References and Function OverloadingC++ Question on References and Function Overloading
C++ Question on References and Function Overloading
 
Db2 For I Parallel Data Load
Db2 For I Parallel Data LoadDb2 For I Parallel Data Load
Db2 For I Parallel Data Load
 
DiceSimulatorProgram
DiceSimulatorProgramDiceSimulatorProgram
DiceSimulatorProgram
 

More from Srinimf-Slides

More from Srinimf-Slides (20)

software-life-cycle.pptx
software-life-cycle.pptxsoftware-life-cycle.pptx
software-life-cycle.pptx
 
Python Tutorial Questions part-1
Python Tutorial Questions part-1Python Tutorial Questions part-1
Python Tutorial Questions part-1
 
Cics testing and debugging-session 7
Cics testing and debugging-session 7Cics testing and debugging-session 7
Cics testing and debugging-session 7
 
CICS error and exception handling-recovery and restart-session 6
CICS error and exception handling-recovery and restart-session 6CICS error and exception handling-recovery and restart-session 6
CICS error and exception handling-recovery and restart-session 6
 
Cics program, interval and task control commands-session 5
Cics program, interval and task control commands-session 5Cics program, interval and task control commands-session 5
Cics program, interval and task control commands-session 5
 
Cics data access-session 4
Cics data access-session 4Cics data access-session 4
Cics data access-session 4
 
CICS basic mapping support - session 3
CICS basic mapping support - session 3CICS basic mapping support - session 3
CICS basic mapping support - session 3
 
Cics application programming - session 2
Cics   application programming - session 2Cics   application programming - session 2
Cics application programming - session 2
 
CICS basics overview session-1
CICS basics overview session-1CICS basics overview session-1
CICS basics overview session-1
 
The best Teradata RDBMS introduction a quick refresher
The best Teradata RDBMS introduction a quick refresherThe best Teradata RDBMS introduction a quick refresher
The best Teradata RDBMS introduction a quick refresher
 
The best ETL questions in a nut shell
The best ETL questions in a nut shellThe best ETL questions in a nut shell
The best ETL questions in a nut shell
 
IMS DC Self Study Complete Tutorial
IMS DC Self Study Complete TutorialIMS DC Self Study Complete Tutorial
IMS DC Self Study Complete Tutorial
 
How To Master PACBASE For Mainframe In Only Seven Days
How To Master PACBASE For Mainframe In Only Seven DaysHow To Master PACBASE For Mainframe In Only Seven Days
How To Master PACBASE For Mainframe In Only Seven Days
 
Assembler Language Tutorial for Mainframe Programmers
Assembler Language Tutorial for Mainframe ProgrammersAssembler Language Tutorial for Mainframe Programmers
Assembler Language Tutorial for Mainframe Programmers
 
The Easytrieve Presention by Srinimf
The Easytrieve Presention by SrinimfThe Easytrieve Presention by Srinimf
The Easytrieve Presention by Srinimf
 
Writing command macro in stratus cobol
Writing command macro in stratus cobolWriting command macro in stratus cobol
Writing command macro in stratus cobol
 
PLI Presentation for Mainframe Programmers
PLI Presentation for Mainframe ProgrammersPLI Presentation for Mainframe Programmers
PLI Presentation for Mainframe Programmers
 
PL/SQL Interview Questions
PL/SQL Interview QuestionsPL/SQL Interview Questions
PL/SQL Interview Questions
 
Macro teradata
Macro teradataMacro teradata
Macro teradata
 
DB2-SQL Part-2
DB2-SQL Part-2DB2-SQL Part-2
DB2-SQL Part-2
 

Recently uploaded

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Recently uploaded (20)

Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 

20 DFSORT Tricks For Zos Users - Interview Questions

  • 2. I am giving here only sysin code so that you can get quick refresh: Y4T = YYYYMMDD //SORTOUT DD SYSOUT=* //SYSIN DD * OPTION COPY INREC BUILD=(1,8,Y4T,TOJUL=Y4T) /* We converted to Julian date YYYYDDD 2
  • 3. OPTION COPY OUTREC OVERLAY=(30:16,8,Y4T,TOGREG=Y2T) OUTFIL INCLUDE=(30,1,CH,EQ,C'*'),BUILD=(1,25) Wherever ‘*’ is there in date starting position. Those records we can get in the output. 3
  • 4. //SYSIN DD * OPTION COPY INREC OVERLAY=(20:1,8,Y4T,DATEDIFF,10,8,Y4T) /*  Output contains différence between dates. 4
  • 5. // SET INPVAR1='BBDY1' // SET INPVAR2='BBJOB' the following DFSORT symbols would be built in SYMNAMES: the INCLUDE statement would be transformed to: INCLUDE COND=(8,5,CH,EQ,C'BBDY1',OR,8,5,CH,EQ,C'BBJOB' ) 5
  • 6. //SYSIN DD * OPTION COPY OUTFIL FNAMES=OUT1,INCLUDE=(1,4,CH,EQ,C'1010'),ACCEPT=100 OUTFIL FNAMES=OUT2,INCLUDE=(1,4,CH,EQ,C'1020'),ACCEPT=100 OUTFIL FNAMES=OUT3,INCLUDE=(1,4,CH,EQ,C'1030'),ACCEPT=100 OUTFIL FNAMES=OUT4,INCLUDE=(1,4,CH,EQ,C'1040'),ACCEPT=100 /* This trick we use to split input record into 4 outfiles. 6
  • 8. //JK1 EXEC PGM=SORT //SYSOUT DD SYSOUT=* //IN1 DD DSN=... file 1 //IN2 DD DSN=... file 2 //OUT DD DSN=... output file //SYSIN DD * JOINKEYS F1=IN1,FIELDS=(1,3,A),SORTED JOINKEYS F2=IN2,FIELDS=(1,3,A),SORTED REFORMAT FIELDS=(F1:1,9,F2:5,5) OPTION COPY OUTFIL FNAMES=OUT,BUILD=(1,9,X,10,5) /* File A 000 $$$$$ File B 001 BBBBB Output 001 AAAAA BBBBB 8
  • 9. //JK2 EXEC PGM=SORT //SYSOUT DD SYSOUT=* //IN1 DD DSN=... input file1 (FB/18) //IN2 DD DSN=... input file2 (FB/22) //OUT DD DSN=... output file (FB/27) //SYSIN DD * JOINKEYS F1=IN1,FIELDS=(12,4,A,3,9,A) JOINKEYS F2=IN2,FIELDS=(1,4,A,6,9,A) REFORMAT FIELDS=(F2:1,22,F1:1,1,17,2) OPTION COPY OUTFIL FNAMES=OUT,BUILD=(1,22,X,23,1,X,24,2) /* 9
  • 10. //CJ EXEC PGM=SORT //SYSOUT DD SYSOUT=* //IN1 DD DSN=... input fileA (FB/30) //IN2 DD DSN=... input fileB (FB/16) //SORTOUT DD DSN=... output file (FB/36) //SYSIN DD * JOINKEYS F1=IN1,FIELDS=(1,10,A) JOINKEYS F2=IN2,FIELDS=(1,10,A) REFORMAT FIELDS=(F2:1,16,F1:11,20) OPTION COPY /* 10
  • 11. //JK2 EXEC PGM=SORT //SYSOUT DD SYSOUT=* //IN1 DD DSN=... input file1 (FB/25) //IN2 DD DSN=... input file2 (FB/15) //SORTOUT DD DSN=... output file (FB/15) //SYSIN DD * JOINKEYS F1=IN1,FIELDS=(7,9,A) JOINKEYS F2=IN2,FIELDS=(1,9,A) REFORMAT FIELDS=(F2:1,15) OPTION COPY /* => Now the data is from File2 11
  • 12. //SYSIN DD * JOINKEYS F1=IN1,FIELDS=(7,9,A) JOINKEYS F2=IN2,FIELDS=(1,9,A) JOIN UNPAIRED,F1,ONLY OPTION COPY /* 12
  • 13. //JK4 EXEC PGM=SORT //SYSOUT DD SYSOUT=* //IN1 DD DSN=... input file1 (VB) //IN2 DD DSN=... input file2 (VB) //SORTOUT DD DSN=... output file (VB) //SYSIN DD * JOINKEYS F1=IN1,FIELDS=(11,9,A) JOINKEYS F2=IN2,FIELDS=(5,9,A) JOIN UNPAIRED,F1,ONLY OPTION COPY /* 13
  • 14. //JK5 EXEC PGM=SORT //SYSOUT DD SYSOUT=* //IN1 DD DSN=... input File1 (FB/10) //IN2 DD DSN=... input File2 (FB/10) //OUT12 DD SYSOUT=* names in File1 and File2 //OUT1 DD SYSOUT=* names in File1 only //OUT2 DD SYSOUT=* names in File2 only //SYSIN DD * JOINKEYS F1=IN1,FIELDS=(1,10,A) JOINKEYS F2=IN2,FIELDS=(1,10,A) JOIN UNPAIRED,F1,F2 REFORMAT FIELDS=(F1:1,10,F2:1,10,?) OPTION COPY OUTFIL FNAMES=OUT12,INCLUDE=(21,1,CH,EQ,C'B'), BUILD=(1,10) OUTFIL FNAMES=OUT1,INCLUDE=(21,1,CH,EQ,C'1'), BUILD=(1,10) OUTFIL FNAMES=OUT2,INCLUDE=(21,1,CH,EQ,C'2'), BUILD=(11,10) /* 14
  • 16. SUM FIELDS=NONE,XSUM SUM FIELDS=NONE => it will not keep duplicates. It will remove duplicate records. 16
  • 18. These will be used for report generation purpose. Some shops use SORT, and others use Easytrieve. Just go through reference section. These are commonly asked questions in Interviews. 18