My requirement is to delete some records from an input file based on the parm card through sort.
For ex :
I am having a input card wherein there are records pertaining to master id's
such as :
97515384
97514564
98763524
This list could be any number and dynamically built.
The requirement is to remove the records pertaining to above mentioned master ids from an input file .
I had seen earlier post wherein Frank has posted a sort for such type of requirment but there it was limited to one input rec . The following is the Sort
Code:
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file1 (one record with parameter)
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN DD *
OPTION COPY
* Create DFSORT Symbol as:
* TARG,+nnn
OUTREC BUILD=(C'TARG,+',1,3,80:X)
/*
//S2 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=... input file2
//SORTOUT DD DSN=... output file
//SYSIN DD *
OPTION COPY
* Use TARG symbol in INCLUDE condition.
INCLUDE COND=(1,3,ZD,GT,TARG)
/*
Frank: Can it be modified for my requirement , if yes then how .
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
If your first step generated the INCLUDE and ORs for each record in your input you should be able to do it.
Header for the "INCLUDE COND=(" and TRAILER for the closing ")" and output detail of "1,3,ZD,EQ,nnnnn,OR," for each input....
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
Vishal_a,
The idea of generating the Include conditions wouldn't be an ideal solution in this case as the no: of records may vary.
There are couple of ways to get the desired results. In order to help you with the optimal solution, I need the following details.
1. What is the LRECL and RECFM of the parm dataset and the input file
2. What is the postion and format of the master ids in both files.
3. Can the input file can have duplicates?
The idea of generating the Include conditions wouldn't be an ideal solution in this case as the no: of records may vary.
There are couple of ways to get the desired results. In order to help you with the optimal solution, I need the following details.
Skolusu wrote:
1. What is the LRECL and RECFM of the parm dataset and the input file
2. What is the postion and format of the master ids in both files.
3. Can the input file can have duplicates?
Skolusu
1. The Lrecl of the parm dataset is 80 byte and recfm of FB dsorg=PS
2. Position of Master id in parm dataset is starting from 1st byte upto 8 byte long and in the input file is starting from 12 th byte upto 8 byte long and ZD format.
3. Chances are very low that there will be duplicates but still we can incoporate the functionlaity.
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
Vishal_a,
You did not tell me what is the LRECL and RECFM of the input file. I assumed it to be FB recfm and 80 bytes in length. The following DFSORT/ICETOOL JCL will give you the desired results.
Thanks a ton Skolusu for your precious time and effort for my problem.
The input file is FB format and 105 bytes in length.
Can you modify it as per this requirement and if dont mind can explain this Sort a little bit this would help in increasing my knowledge about the versatility of the Sort.
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
vishal_a,
Looks like you don't have the PTF installed which supports the WHEN=Group function. Here is an alternative way of getting the desired results.
The first copy takes the 80 parm file and create a 106 byte file while moving the key to pos 12 and we add an indicator 'y' at pos 106.
The second copy takes the 105 input file and pad a space a pos 106.
Since I used disp=mod, the contents of both files will be appended together and using splice we will push the indicator 'y' to all the matching records in file 2. And using a OMIT condition we remove these records and using a build we remove the indicator we created at pos 106.