IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

write numbers not present in the file


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Nov 13, 2008 4:02 pm
Reply with quote

Hi,
I have a file which can have numbers as a record
Numbers can be from 1 to 9999999 in sorted order.
I want to write output file with numbers which are not present in the input file.
Sample input file:
Code:

0000001
0000005
0000010
0000015

Output:
Code:

0000002
0000003
0000004
0000006
0000007
0000008
0000009
0000011
0000012
0000013
0000014
0000016
'
'
'
9999999
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Thu Nov 13, 2008 4:43 pm
Reply with quote

You could create a file which has a record for all the possible numbers and concatenate to your 'real' file as input to DFSORT. DFSORT job would use SUM FIELDS=(NONE) to drop duplicates. That way you get the unmatched records in your output.

Garry.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Nov 13, 2008 4:54 pm
Reply with quote

Quote:

DFSORT job would use SUM FIELDS=(NONE) to drop duplicates

This will again give me file will all possible records.
Quote:
That way you get the unmatched records in your output.

SUM FIELDS=NONE will reject matched records but will keep one instance of it icon_sad.gif
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Thu Nov 13, 2008 4:57 pm
Reply with quote

odd business need icon_eek.gif
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Nov 13, 2008 5:00 pm
Reply with quote

Quote:
odd business need

These records in the file are lables which are used.
So requirement is to find lables which are not used.
Back to top
View user's profile Send private message
muthuvel

Active User


Joined: 29 Nov 2005
Posts: 217
Location: Canada

PostPosted: Thu Nov 13, 2008 5:15 pm
Reply with quote

Quote:
So requirement is to find lables which are not used.

Where is the master set of labels stored? May be knowing that can help us.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Nov 13, 2008 5:28 pm
Reply with quote

Quote:
Where is the master set of labels stored? May be knowing that can help us.


Well, As mentioned already its in input file
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Thu Nov 13, 2008 5:30 pm
Reply with quote

Sambhaji,

As suggeted by Garry, concatenate "your" file to the master file and SELECT records with no duplicates (NODUPS)
Back to top
View user's profile Send private message
nelson.pandian

Active User


Joined: 09 Apr 2008
Posts: 133
Location: Phoenix, AZ

PostPosted: Thu Nov 13, 2008 5:33 pm
Reply with quote

Hi Sambhaji ,

Hope this code will give you desire output

Code:
//S1    EXEC  PGM=ICEMAN                               
//SYSOUT    DD  SYSOUT=*                               
//SORTIN DD *                                         
DUMMY RECORD                                           
/*                                                     
//SORTOUT       DD DSN=(OUTfile1 --> 7 record length),         
//             DISP=(NEW,CATLG,DELETE),               
//             UNIT=SYSDA,SPACE=(TRK,(500,100),RLSE), 
//             DCB=(RECFM=FB,LRECL=7,BLKSIZE=0)       
//*                                                   
//SYSIN    DD    *                                     
  OPTION COPY                                         
  OUTFIL REPEAT=10000000,BUILD=(SEQNUM,7,ZD,START=1)   
/*                                                     
//S2  EXEC PGM=ICETOOL                           
//*                                                   
//SYSOUT       DD  SYSOUT=*                           
//TOOLMSG      DD  SYSOUT=*                           
//DFSMSG       DD  SYSOUT=*                           
//*                                           
//I1           DD  DSN=(INFILE1 --> 7 record length), (Input from the prev step sortout)
//            DISP=SHR                         
//*                                           
//I2           DD  *                           
0000001                                       
0000005                                       
0000010                                       
0000015                                       
0000020                                       
0000025                                       
0000030                                       
0000035                                       
0000040                                       
0000050                                       
/*                                             
//*                                           
//T1           DD  DSN=&&T1,                   
//            DISP=(MOD,PASS),                 
//            UNIT=SYSDA,SPACE=(CYL,(100,100),RLSE)     
//*                                                     
//O1           DD  DSN=(OUTfile1 --> 7 record length),           
//            DISP=(NEW,CATLG,DELETE),                   
//            UNIT=(SYSDA,5),                           
//            SPACE=(TRK,(500,500),RLSE),               
//            DCB=(RECFM=FB,LRECL=7,BLKSIZE=0)           
//*                                                     
//TOOLIN   DD  *    *** CONSTANT CONTROL CARDS ***       
  COPY FROM(I2) TO(T1) USING(CTL1)                       
  COPY FROM(I1) TO(T1) USING(CTL2)                       
  SPLICE FROM(T1) TO(O1) ON(1,7,CH) KEEPNODUPS KEEPBASE -
    WITHALL WITH(1,7) USING(CTL3)                       
/*                                                       
//CTL1CNTL DD *                                         
  INREC OVERLAY=(8:C'11')                               
/*                                                       
//CTL2CNTL DD *                                         
/*                                                     
//CTL3CNTL DD *                                         
  OUTFIL FNAMES=O1,INCLUDE=(8,2,CH,EQ,C'22'),BUILD=(1,7)
/*                                                     

[/code]
Back to top
View user's profile Send private message
nelson.pandian

Active User


Joined: 09 Apr 2008
Posts: 133
Location: Phoenix, AZ

PostPosted: Thu Nov 13, 2008 5:37 pm
Reply with quote

Replace the control card2 as follows

Code:
//CTL2CNTL DD *                 
  INREC OVERLAY=(8:C'22')       
/*                               
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Nov 13, 2008 6:05 pm
Reply with quote

Thanks a lot Arun and Garry,
I used below,
Code:

//INDUM DD *                                                   
DUMMY REC                                                       
/*                                                             
//TEMP1IN DD DSN=alllablesdataset,DISP=SHR,                 
//      SPACE=(TRK,(750,75),RLSE),LRECL=4,RECFM=FB             
//TEMP2IN DD  DSN=alllabledataset,DISP=OLD                 
//        DD DSN=inputdataset,DISP=OLD               
//OUTFILE DD DSN=unusedlablesdataset,DISP=SHR,             
//       SPACE=(TRK,(750,75),RLSE),LRECL=7,BLKSIZE=700         
//TOOLIN   DD    *                                             
  COPY FROM(INDUM) TO(TEMP1IN) USING(CTL1)                     
  SELECT FROM(TEMP2IN) TO(OUTFILE) ON(1,4,PD) USING(CTL2) NODUPS
/*                                                             
//CTL1CNTL DD *                                                 
  OUTFIL FNAMES=TEMP1IN,REPEAT=9999999,                         
  BUILD=(SEQNUM,4,PD)                                           
/*                                                             
//CTL2CNTL DD *                       
  SORT FIELDS=(1,4,PD,A)               
  OUTFIL FNAMES=OUTFILE,               
  OUTREC=(1,4,PD,EDIT=(TTTTTTT))       
/*                                     
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Mon Feb 16, 2009 11:07 pm
Reply with quote

sambhaji,

You don't have to generate the seqnum every time you run the job. Create it once and you can always concatenate it to your input. Here is the job will which will give you the desired results

Code:

//*************************************************************
//* RUN THIS STEP ONLY ONCE WHICH WILL GENERATE THE BATCH     *
//* NUMBERS FROM 1 THRU 9999999.                              *
//*************************************************************
//RUN1TIME EXEC PGM=SORT                                       
//SYSOUT   DD SYSOUT=*                                         
//SORTIN   DD *                                               
DUMMY RECORD                                                   
//SORTOUT  DD DSN=your constant num file,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,
//            SPACE=(CYL,(60,20),RLSE)     
//SYSIN    DD *                                               
  SORT FIELDS=COPY                                             
  OUTFIL REPEAT=9999999,BUILD=(SEQNUM,4,PD)
//*


This should be the only step in your regular job stream
Code:

//*************************************************************
//* CONCATENATE THE FULL NUMBER FILE CREATED IN RUN1TIME      *
//* (RUN THAT STEP ONLY ONCE) AND YOUR INPUT FILE.            *
//* ANY MATCHING  NUMBER IN YOUR INPUT WILL BE A DUPLICATE    *
//* SO USING A SELECT OPERATOR WE PICK THE NODUPS WHICH ARE   *
//* THE MISSING NUMBERS.                                      *
//*************************************************************
//STEP0100 EXEC PGM=ICETOOL                                   
//TOOLMSG  DD SYSOUT=*                                         
//DFSMSG   DD SYSOUT=*                                         
//IN       DD DSN=your constant num file,DISP=SHR
//         DD DSN=your input,DISP=SHR 
//OUT      DD DSN=your missing num file,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,
//            SPACE=(CYL,(60,20),RLSE)
//TOOLIN   DD *                                         
  SELECT FROM(IN) TO(OUT) ON(1,4,PD) NODUPS USING(CTL1)
//CTL1CNTL DD *                                         
  OUTFIL FNAMES=OUT,BUILD=(1,4,PD,M11,LENGTH=7)         
/*
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue Feb 17, 2009 8:58 am
Reply with quote

Thanks Kolusu for Suggestion but this particular task itself was one time activity for production support team.

In case of frequent run, solution given by you is always preferable...
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top