JCL -sort

In this Mainframe Forum - You can post your queries on DFSORT, ICETOOL , SyncSort & JCL Utilities

Moderators: Frank Yaeger, Moderator Group

Post Reply
juhi.verma03@gmail.com
Member
Posts: 2
Joined: Wed Apr 25, 2012 10:28 pm

JCL -sort

Post by juhi.verma03@gmail.com » Wed Apr 25, 2012 10:34 pm

Hi can anyone help me on below query as:

I need to searh a bill id (which is to be picked from one file) and search in the whole input file. If that bill id is found in input file then all the records with thta bil id should be removed from input files.

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Wed Apr 25, 2012 11:05 pm

You need to give a clearer description of exactly what it is you want to do before anyone can help you.

Please show an example of the records in each input file (relevant fields only) and what you expect for output. Explain the "rules" for getting from input to output. Give the starting position, length and format of each relevant field. Give the RECFM and LRECL of the input files. If file1 can have duplicates within it, show that in your example. If file2 can have duplicates within it, show that in your example.

Depending on exactly what you want to do, you might want to use DFSORT's JOINKEYS function or some other DFSORT function. You can find plenty of examples online. The DFSORT doc can be accessed from:

http://www.ibm.com/support/docview.wss? ... g3T7000080
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

juhi.verma03@gmail.com
Member
Posts: 2
Joined: Wed Apr 25, 2012 10:28 pm

Post by juhi.verma03@gmail.com » Thu Apr 26, 2012 9:46 pm

Hi

In file 1 : we have record as:

SCH1234567890000702
NMM12345678924.04.2012
MEM123456789XXYYYZZZ ZZZZZ
SCH2222222220000890
MEM222222222TK92683090


and in file2:
222222222

output file should be like:

SCH1234567890000702
NMM12345678924.04.2012
MEM123456789XXYYYZZZ ZZZZZ

That means i need to remove all the records from the input file1 which is in file2.

Like above eg:watever records conatin 222222222 from 4th position (9 digit) i need to eliminate from input and rest of the records must eb in output file.
All the files have RECFM= VB and LRECL= 621.

I am using SORT

Can anybody help me on this.
Thanks
Juhi

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Thu Apr 26, 2012 10:10 pm

You can use a DFSORT job like the following to do what you asked for. Be sure to use input file2 (one record) for STEP S1 and input file1 (multiple records) for STEP2.

Code: Select all

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=...  input file2 (VB)
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN DD *
  OPTION COPY
  OUTFIL VTOF,
    BUILD=(C'TARG,''',5,9,C'''',80:X)
//S2 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=...  input file1 (VB)
//SORTOUT DD DSN=...  output file (VB)
//SYSIN DD *
  OPTION COPY,VLSCMP
  OMIT COND=(8,9,CH,EQ,TARG)
/*
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others