Page 1 of 1

JCL -sort

Posted: Wed Apr 25, 2012 10:34 pm
by juhi.verma03@gmail.com
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.

Posted: Wed Apr 25, 2012 11:05 pm
by Frank Yaeger
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

Posted: Thu Apr 26, 2012 9:46 pm
by juhi.verma03@gmail.com
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

Posted: Thu Apr 26, 2012 10:10 pm
by Frank Yaeger
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)
/*