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

Change the contents of a record


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   This topic is locked: you cannot edit posts or make replies.
View previous topic :: View next topic  
Author Message
prateek_nanda

New User


Joined: 13 Jul 2007
Posts: 19
Location: Gurgaon

PostPosted: Fri Oct 17, 2008 10:06 am
Reply with quote

We have 2 files In first file we have records like 123,678,456 and in second file we are having 123, 456, 677. Now I want to 678 in my 3 rd file. How to do it plz tell.

Thanks
Prateek
Back to top
View user's profile Send private message
HappySrinu

Active User


Joined: 22 Jan 2008
Posts: 194
Location: India

PostPosted: Fri Oct 17, 2008 10:14 am
Reply with quote

Do you want unique data in each record in first file in to 3rd file?

Are those both are CSV files ?

what's the record length/format?

Please be clear with your example to get better solution
Back to top
View user's profile Send private message
prateek_nanda

New User


Joined: 13 Jul 2007
Posts: 19
Location: Gurgaon

PostPosted: Fri Oct 17, 2008 10:51 am
Reply with quote

Thanks for replying back

Both the files are Normal Flat files ( PS datasets ) of record length 80 and is of Fixed Block format.

Example:--

File 1
ABCD12345678
DEFG12345678
HIJK12345678
LMNO12345678

File 2
ABCD12345678
DEFG12345678
BBBB12345678

Now what I want in file 3 is

File 3

HIJK12345678
LMNO12345678
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Fri Oct 17, 2008 11:18 am
Reply with quote

Am I correct im assuming that if the record key appears in file 2 then the record from file 1 is to be ignored.

i.e. The values of file 2 are exclude parameters for file 1
Back to top
View user's profile Send private message
prateek_nanda

New User


Joined: 13 Jul 2007
Posts: 19
Location: Gurgaon

PostPosted: Fri Oct 17, 2008 11:28 am
Reply with quote

Hi,

Yes. If the same record is present in both File 1 and File 2 then it is to be ignored. A record which is present in File 1 only and not present in File 2 should be written to File 3. That's the main requirement.

Thanks!!
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Fri Oct 17, 2008 11:39 am
Reply with quote

Please supply the following information for file 1 and file 2

RECFM=
LRECL=
Key position=
Key length=

Are there duplicate key fields in file 1 or file2
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Oct 17, 2008 11:03 pm
Reply with quote

Prateek,

You can use a DFSORT/ICETOOL job like the following to do what you asked for. I assumed your input files have RECFM=FB and LRECL=80, but you can change the job appropriately for other attributes. I also assumed neither input file has duplicates within it. If either input file has duplicates within it (e.g. two ABCD12345678 records in input file1), show an example of input and output for that (it will require a different solution).

Code:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN1 DD *
ABCD12345678
DEFG12345678
HIJK12345678
LMNO12345678
/*
//IN2 DD *
ABCD12345678
DEFG12345678
BBBB12345678
/*
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD SYSOUT=*
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SELECT FROM(T1) TO(OUT) ON(1,12,CH) NODUPS USING(CTL3)
//CTL1CNTL DD *
  INREC OVERLAY=(81:C'1')
/*
//CTL2CNTL DD *
  INREC OVERLAY=(81:C'2')
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=OUT,INCLUDE=(81,1,CH,EQ,C'1'),
    BUILD=(1,80)
/*
Back to top
View user's profile Send private message
prateek_nanda

New User


Joined: 13 Jul 2007
Posts: 19
Location: Gurgaon

PostPosted: Mon Oct 20, 2008 3:57 pm
Reply with quote

It Worked for me..
Thanks a lot...
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Mon Oct 20, 2008 7:26 pm
Reply with quote

Hi,

Out of curiosity, I would like to know how many steps does it take if one has to achieve the same result NOT using ICETOOL.

Thank you all.
Back to top
View user's profile Send private message
Escapa

Senior Member


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

PostPosted: Mon Oct 20, 2008 7:42 pm
Reply with quote

IT depends on number of statements in TOOLIN (SORT\COPY\SELECT)...

Here three...

icon_smile.gif
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Mon Oct 20, 2008 7:48 pm
Reply with quote

ramsri wrote:
Hi,
Out of curiosity, I would like to know how many steps does it take if one has to achieve the same result NOT using ICETOOL.
Thank you all.

Do you mean job steps, i.e. programs or as Sambhaji has interpretted it, the number of sub steps within a job step.
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Mon Oct 20, 2008 8:23 pm
Reply with quote

Hi, Sambhaji & expat.

Thanks for the replies. I was thinking as expat correctly caught.....the number of job steps....

This is how I interpreted if one has to do it without using ICETOOL.

Quote:

STEP01 - IN1 - OUTREC=(1,12,15:C'1')
STEP02 - IN2 - OUTREC=(1,12,15:C'2')
STEP03 - OUTPUT FROM IN1 & IN2 AS INPUT - SORT FIELDS=(1,4,CH,A) WITH SUM FIELDS=NONE
STEP04 - OUTPUT FROM STEP03 AS INPUT - INCLUDE=(15,1,CH,EQ,C'1')


I tried this approach but did not save JCL as it produced one extra record from IN1.

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

Senior Member


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

PostPosted: Mon Oct 20, 2008 8:34 pm
Reply with quote

Quote:

Quote:

STEP01 - IN1 - OUTREC=(1,12,15:C'1')
STEP02 - IN2 - OUTREC=(1,12,15:C'2')
STEP03 - OUTPUT FROM IN1 & IN2 AS INPUT - SORT FIELDS=(1,4,CH,A) WITH SUM FIELDS=NONE
STEP04 - OUTPUT FROM STEP03 AS INPUT - INCLUDE=(15,1,CH,EQ,C'1')



Hi Ramsri, No need of STEP04
You can do STEP03 and STEP04 in one step.. icon_smile.gif
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Mon Oct 20, 2008 8:55 pm
Reply with quote

Sambhaji,

I tried to combine STEP03 & STEP04 into STEP03 itself but was getting 4 records. I've given my full SORT job below that did not work as intended......it will be a great help if you could fine tune it....... icon_smile.gif

Code:

//STEP0001 EXEC PGM=SORT                                           
//SORTOUT  DD DSN=&&T1,DISP=(MOD,PASS,DELETE),SPACE=(TRK,(1,1),RLSE)
//SYSOUT   DD SYSOUT=*                                             
//SORTIN   DD *                                                     
ABCD12345678                                                       
DEFG12345678                                                       
HIJK12345678                                                       
LMNO12345678                                                       
//SYSIN    DD *                                                     
 SORT FIELDS=COPY                                                   
 OUTREC FIELDS=(1,12,15:C'1')                                       
/*                                                                 
//STEP0002 EXEC PGM=SORT                                           
//SORTOUT  DD DSN=&&T1,DISP=(MOD,PASS,DELETE),SPACE=(TRK,(1,1),RLSE)
//SYSOUT   DD SYSOUT=*                                             
//SORTIN   DD *                                                     
ABCD12345678                                                       
DEFG12345678                                                       
BBBB12345678                                                       
//SYSIN    DD *                                                       
 SORT FIELDS=COPY                                                     
 OUTREC FIELDS=(1,12,15:C'2')                                         
/*                                                                   
//STEP0003 EXEC PGM=SORT                                             
//SORTIN   DD DSN=&&T1,DISP=(MOD,DELETE,DELETE),SPACE=(TRK,(1,1),RLSE)
//SYSOUT   DD SYSOUT=*                                               
//SORTOUT  DD SYSOUT=*                                               
//SYSIN    DD *                                                       
 SORT FIELDS=(1,4,CH,A)                                               
 SUM FIELDS=NONE                                                     
 INCLUDE COND=(15,1,CH,EQ,C'1')                                       
/*                                                                   


Output:

Code:

ABCD12345678  1
DEFG12345678  1
HIJK12345678  1
LMNO12345678  1


Thanks.
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Mon Oct 20, 2008 8:59 pm
Reply with quote

Sorry guys.... icon_redface.gif I would append my altered STEP03 and new step STEP04 here.....

Code:

//STEP0003 EXEC PGM=SORT                                               
//SORTIN   DD DSN=&&T1,DISP=(MOD,DELETE,DELETE),SPACE=(TRK,(1,1),RLSE)
//SYSOUT   DD SYSOUT=*                                                 
//SORTOUT  DD DSN=&&T2,DISP=(MOD,PASS,DELETE),SPACE=(TRK,(1,1),RLSE)   
//SYSIN    DD *                                                       
 SORT FIELDS=(1,4,CH,A)                                               
 SUM FIELDS=NONE                                                       
/*                                                                     
//STEP0004 EXEC PGM=SORT                                               
//SORTIN   DD DSN=&&T2,DISP=(MOD,DELETE,DELETE),SPACE=(TRK,(1,1),RLSE)
//SYSOUT   DD SYSOUT=*                                                 
//SORTOUT  DD SYSOUT=*                                                 
//SYSIN    DD *                                                       
 SORT FIELDS=COPY                                                     
 INCLUDE COND=(15,1,CH,EQ,C'1')                                       
/*                                                                     


With this altered STEP03 & STEP04, I got the below output. icon_surprised.gif

Code:

ABCD12345678  1
HIJK12345678  1
LMNO12345678  1


Thanks.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Mon Oct 20, 2008 9:17 pm
Reply with quote

Quote:
it will be a great help if you could fine tune it.......


Why should we waste our time on this? You can do this with SELECT ... NODUPS quite easily. What is the point of figuring out how to do it a more complex way? If you want to do that for "fun", figure it out yourself. Don't ask the rest of us to help. Most of us have better things to do. I'm locking this topic.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   This topic is locked: you cannot edit posts or make replies. View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Validating record count of a file is ... DFSORT/ICETOOL 13
Search our Forums:

Back to Top