• Rajesh A R

F1 for Mainframe

F1 for Mainframe

Tag Archives: indicator

SORT JOIN – UNPAIRED RECORDS INDICATOR

12 Monday Mar 2012

Posted by rajeshar in SORT

≈ 1 Comment

Tags

indicator, JCL, JOIN, mainframe, SORT, unpaired

SORT JOIN – UNPAIRED RECORDS INDICATOR

Records from 2 files can be joined used SORT. An indicator can used to see from which the file the record has been written to the output file.

//JKE5 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTJNF1 DD DSN=FIRST.FILE,DISP=SHR
//SORTJNF2 DD DSN=SECOND.FILE,DISP=SHR
//F1ONLY DD SYSOUT=*
//F2ONLY DD SYSOUT=*
//BOTH DD SYSOUT=*
//SYSIN DD *
* Control statements for JOINKEYS application
JOINKEYS FILE=F1,FIELDS=(1,10,A),SORTED,NOSEQCK
JOINKEYS FILE=F2,FIELDS=(7,10,A),SORTED,NOSEQCK
JOIN UNPAIRED,F1,F2
REFORMAT FIELDS=(F1:1,14,F2:1,20,?)
* Control statements for main task (joined records)
OPTION COPY
OUTFIL FNAMES=F1ONLY,INCLUDE=(35,1,CH,EQ,C’1′),
BUILD=(1,14)
OUTFIL FNAMES=F2ONLY,INCLUDE=(35,1,CH,EQ,C’2′),
BUILD=(15,20)
OUTFIL FNAMES=BOTH,INCLUDE=(35,1,CH,EQ,C’B’),
BUILD=(1,14,/,15,20)
/*

IF1 file. FILE=F1 tells DFSORT that the ddname for the F1 file is |SORTJNF1. FIELDS=(1,10,A) tells DFSORT that the key is in positions |1-10 ascending. Since SORTED is specified, indicating that the records are already in order by the specified binary key, DFSORT will copy |the SORTJNF1 records. Since NOSEQCK is specified, DFSORT will not |check that the records are in order by the key. (Only use NOSEQCK |if you know for sure that the records are in order by the key.)

The second JOINKEYS statement defines the ddname and key for the |F2 file. FILE=F2 tells DFSORT that the ddname for the F2 file is |SORTJNF2. FIELDS=(7,10,A) tells DFSORT that the key is in positions |7-16 ascending. Since SORTED is specified, indicating that the records |are already in order by the specified binary key, DFSORT will copy |the SORTJNF2 records. Since NOSEQCK is specified, DFSORT will not |check that the records are in order by the key. (Only use NOSEQCK |if you know for sure that the records are in order by the key.)

The JOIN statement tells DFSORT that the joined records should |include the unpaired F1 and F2 records as well as the paired F1/F2 |records.

The REFORMAT statement defines the fields to be extracted for the |joined records in the order in which they are to appear, and includes |an indicator in the last position that will be set to ‘1’ if the key |is found only in the F1 file, ‘2’ if the key is found only in the |F2 file, or ‘B’ if the key is found in the F1 file and in the F2 file. | FIELDS=(F1:1,14,F2:1,20,?) tells DFSORT to create the joined records |as follows:

Joined Record Positions Extracted from

|———————– —————–

|1-14 F1 positions 1-14

|15-34 F2 positions 1-20

|35 Indicator of where key was found

The OPTION COPY statement tells DFSORT to copy the joined records. | The OUTFIL statements use the indicator in position 35 to determine |where to find the F1 or F2 fields in the joined records and where |to write the fields (F1ONLY, F2ONLY or BOTH).

If you would like to Earn Free Stocks, Credit card Points and Bank account Bonuses, Please visit My Finance Blog

You may also like to look at:

Important SQL CODES and ABEND CODES
SORT JOIN – TO JOIN TWO FILES BASED ON A KEY
KNOW YOUR MAINFRAME
REXX – INITIAL SETUP
HOW TO SUBMIT A BATCH JOB FROM THE CICS PROGRAM
CICS – EXEC interface block – EIBRESP Values
CICS – EXEC interface block Fields
Flow of control between COBOL programs, run units, and CICS
CICS INTERVIEW QUESTIONS
CICS TIPS
COBOL – COPY and INCLUDE statements
COBOL – PERFORMANCE IMPROVEMENT
COBOL – SIGN STORED IN COMP, COMP-3 AND DISPLAY FORMATS
SHORTEST COBOL PROGRAM
RESTART LOGIC IN COBOL DB2 Program
GOBACK – EXIT PROGRAM – STOP RUN
Continuation lines in COBOL
Computational items – COMP, COMP 1 , COMP 2, COMP 3
COBOL program format
cobol indicator area column-7 and area a and area b
COBOL INTERVIEW QUESTIONS
COBOL TIPS
COBOL COMPILER OPTIONS
The IDENTIFICATION DIVISION

Rate this:

Subscribe

  • Entries (RSS)
  • Comments (RSS)

Archives

  • November 2020
  • July 2020
  • February 2020
  • January 2020
  • September 2019
  • August 2019
  • October 2018
  • April 2018
  • March 2018
  • December 2017
  • October 2017
  • August 2017
  • July 2017
  • June 2017
  • April 2017
  • March 2017
  • February 2017
  • January 2017
  • December 2016
  • May 2016
  • March 2016
  • February 2016
  • January 2016
  • May 2015
  • September 2013
  • August 2013
  • July 2013
  • June 2013
  • May 2013
  • January 2013
  • December 2012
  • November 2012
  • April 2012
  • March 2012
  • February 2012
  • January 2012
  • April 2011
  • March 2011
  • August 2009
  • June 2009
  • April 2009

Categories

  • Azure
  • CA7
  • CICS
  • COBOL
    • Keywords
  • DB2
  • EASYTRIEVE
  • FILEAID
  • FILEMAXX
  • IMS
  • ISPF
  • JCL
  • KNOW YOUR MAINFRAME
  • Mainframe Migration
  • MAINFRAMES
  • Others
  • REXX
  • SDSF
  • SORT
  • Training
  • TSQL
  • VSAM

Meta

  • Register
  • Log in

Create a free website or blog at WordPress.com.

  • Follow Following
    • F1 for Mainframe
    • Join 88 other followers
    • Already have a WordPress.com account? Log in now.
    • F1 for Mainframe
    • Customize
    • Follow Following
    • Sign up
    • Log in
    • Report this content
    • View site in Reader
    • Manage subscriptions
    • Collapse this bar