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

Introduction of ISPF
Introduction of ISPFIntroduction of ISPF
Introduction of ISPFAnil Bharti
Ā 
JCL FOR FRESHERS
JCL FOR FRESHERSJCL FOR FRESHERS
JCL FOR FRESHERSNirmal Pati
Ā 
Jcl faqs
Jcl faqsJcl faqs
Jcl faqskapa rohit
Ā 
TSO Productivity
TSO ProductivityTSO Productivity
TSO ProductivityDan O'Dea
Ā 
Jcl tutor
Jcl tutorJcl tutor
Jcl tutorshivas
Ā 
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/OSTony Pearson
Ā 
JCL SORT TOOL
JCL SORT TOOLJCL SORT TOOL
JCL SORT TOOLNirmal Pati
Ā 
Mainframe JCL Part - 1
Mainframe JCL Part - 1Mainframe JCL Part - 1
Mainframe JCL Part - 1janaki ram
Ā 
JCL DFSORT
JCL DFSORTJCL DFSORT
JCL DFSORTNirmal Pati
Ā 
Jcl
JclJcl
Jclshivas
Ā 
JCL MAINFRAMES
JCL MAINFRAMESJCL MAINFRAMES
JCL MAINFRAMESkamaljune
Ā 
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/OSCuneyt Goksu
Ā 
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 - 3janaki ram
Ā 
MVS ABEND CODES
MVS ABEND CODESMVS ABEND CODES
MVS ABEND CODESNirmal Pati
Ā 

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

IMSDB-COBOL PROGRAM EXPLANATION
IMSDB-COBOL PROGRAM EXPLANATIONIMSDB-COBOL PROGRAM EXPLANATION
IMSDB-COBOL PROGRAM EXPLANATIONSrinimf-Slides
Ā 
Cobol questions and answers
Cobol questions and answersCobol questions and answers
Cobol questions and answersSweta Singh
Ā 
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 answersjonhmart036
Ā 
Some ISPF Tricks
Some ISPF TricksSome ISPF Tricks
Some ISPF TricksDan O'Dea
Ā 
Basic IMS For Applications
Basic IMS For ApplicationsBasic IMS For Applications
Basic IMS For ApplicationsDan O'Dea
Ā 
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 SecurityDan O'Dea
Ā 
UVP, Mine
UVP, MineUVP, Mine
UVP, MineDan O'Dea
Ā 

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

Letā€™s talk about microbenchmarking
Letā€™s talk about microbenchmarkingLetā€™s talk about microbenchmarking
Letā€™s talk about microbenchmarkingAndrey Akinshin
Ā 
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.pdfapleathers
Ā 
(381877808) 102054282 5-listing-program
(381877808) 102054282 5-listing-program(381877808) 102054282 5-listing-program
(381877808) 102054282 5-listing-programDimz 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.pdfleventhalbrad49439
Ā 
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 2014Supriya Radhakrishna
Ā 
#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.docxajoy21
Ā 
Interfacepackage PJ1; public interface SimpleFractionInterface.pdf
Interfacepackage PJ1; public interface SimpleFractionInterface.pdfInterfacepackage PJ1; public interface SimpleFractionInterface.pdf
Interfacepackage PJ1; public interface SimpleFractionInterface.pdfsutharbharat59
Ā 
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.pdf4babies2010
Ā 
System programs in C language.
System programs in C language.System programs in C language.
System programs in C language.Sudhakar Srivastava
Ā 
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.docxKomlin1
Ā 
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.pdfforwardcom41
Ā 
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 Overloadingmohamed sikander
Ā 
Db2 For I Parallel Data Load
Db2 For I Parallel Data LoadDb2 For I Parallel Data Load
Db2 For I Parallel Data LoadThomas Wolfe
Ā 
DiceSimulatorProgram
DiceSimulatorProgramDiceSimulatorProgram
DiceSimulatorProgramAmy 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

software-life-cycle.pptx
software-life-cycle.pptxsoftware-life-cycle.pptx
software-life-cycle.pptxSrinimf-Slides
Ā 
Python Tutorial Questions part-1
Python Tutorial Questions part-1Python Tutorial Questions part-1
Python Tutorial Questions part-1Srinimf-Slides
Ā 
Cics testing and debugging-session 7
Cics testing and debugging-session 7Cics testing and debugging-session 7
Cics testing and debugging-session 7Srinimf-Slides
Ā 
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 6Srinimf-Slides
Ā 
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 5Srinimf-Slides
Ā 
Cics data access-session 4
Cics data access-session 4Cics data access-session 4
Cics data access-session 4Srinimf-Slides
Ā 
CICS basic mapping support - session 3
CICS basic mapping support - session 3CICS basic mapping support - session 3
CICS basic mapping support - session 3Srinimf-Slides
Ā 
Cics application programming - session 2
Cics   application programming - session 2Cics   application programming - session 2
Cics application programming - session 2Srinimf-Slides
Ā 
CICS basics overview session-1
CICS basics overview session-1CICS basics overview session-1
CICS basics overview session-1Srinimf-Slides
Ā 
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 refresherSrinimf-Slides
Ā 
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 shellSrinimf-Slides
Ā 
IMS DC Self Study Complete Tutorial
IMS DC Self Study Complete TutorialIMS DC Self Study Complete Tutorial
IMS DC Self Study Complete TutorialSrinimf-Slides
Ā 
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 DaysSrinimf-Slides
Ā 
Assembler Language Tutorial for Mainframe Programmers
Assembler Language Tutorial for Mainframe ProgrammersAssembler Language Tutorial for Mainframe Programmers
Assembler Language Tutorial for Mainframe ProgrammersSrinimf-Slides
Ā 
The Easytrieve Presention by Srinimf
The Easytrieve Presention by SrinimfThe Easytrieve Presention by Srinimf
The Easytrieve Presention by SrinimfSrinimf-Slides
Ā 
Writing command macro in stratus cobol
Writing command macro in stratus cobolWriting command macro in stratus cobol
Writing command macro in stratus cobolSrinimf-Slides
Ā 
PLI Presentation for Mainframe Programmers
PLI Presentation for Mainframe ProgrammersPLI Presentation for Mainframe Programmers
PLI Presentation for Mainframe ProgrammersSrinimf-Slides
Ā 
PL/SQL Interview Questions
PL/SQL Interview QuestionsPL/SQL Interview Questions
PL/SQL Interview QuestionsSrinimf-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

Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
Ā 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
Ā 
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 textsMaria Levchenko
Ā 
šŸ¬ The future of MySQL is Postgres šŸ˜
šŸ¬  The future of MySQL is Postgres   šŸ˜šŸ¬  The future of MySQL is Postgres   šŸ˜
šŸ¬ The future of MySQL is Postgres šŸ˜RTylerCroy
Ā 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
Ā 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
Ā 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
Ā 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
Ā 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
Ā 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
Ā 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
Ā 
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 Takeoffsammart93
Ā 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
Ā 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
Ā 
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...Neo4j
Ā 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
Ā 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
Ā 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
Ā 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
Ā 

Recently uploaded (20)

Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
Ā 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
Ā 
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
Ā 
šŸ¬ The future of MySQL is Postgres šŸ˜
šŸ¬  The future of MySQL is Postgres   šŸ˜šŸ¬  The future of MySQL is Postgres   šŸ˜
šŸ¬ The future of MySQL is Postgres šŸ˜
Ā 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
Ā 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
Ā 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
Ā 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
Ā 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Ā 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
Ā 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
Ā 
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
Ā 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
Ā 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
Ā 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Ā 
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...
Ā 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Ā 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
Ā 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
Ā 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
Ā 

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