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

To get the odd record from two files


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
dkarthikreddy

New User


Joined: 14 Mar 2008
Posts: 28
Location: bangalore

PostPosted: Tue Aug 18, 2009 11:30 am
Reply with quote

Hi All,

I have two files with 15 byte account number, in one file i have 171 records and in another file i have the same set of acct numbers but the count here is 170. Now i need that odd one account from first file. How can i get that using JCL.

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

Senior Member


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

PostPosted: Tue Aug 18, 2009 11:38 am
Reply with quote

What SORT product is available at your shop?

Also give LRECL,RECFM of both the files.
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Tue Aug 18, 2009 11:43 am
Reply with quote

/RANT ON
Once more let us clarify exactly what JCL is.

it is Job Control Language.

By itself it does nothing. It is used to invoke the chosen program and to define which datasets are to be used by the DD names associated with the chosen program.

JCL does not have magical powers that solve all problems, JCL is merely the vehicule for telling the processor which program you want it to execute.
/RANT OFF

So, if you might just care to tell us which program you wish the JCL to execute, we might be able to help you
Back to top
View user's profile Send private message
dkarthikreddy

New User


Joined: 14 Mar 2008
Posts: 28
Location: bangalore

PostPosted: Tue Aug 18, 2009 11:48 am
Reply with quote

I meant to say JCL means using a SORT card (PGM = SORT). Can i do using any sort in jcl ( i can do with a cobol pgm ).
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Tue Aug 18, 2009 11:53 am
Reply with quote

Yes, it probably can be done with SORT. Which sort product do you use.
Back to top
View user's profile Send private message
dkarthikreddy

New User


Joined: 14 Mar 2008
Posts: 28
Location: bangalore

PostPosted: Tue Aug 18, 2009 11:55 am
Reply with quote

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

Senior Member


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

PostPosted: Tue Aug 18, 2009 11:59 am
Reply with quote

LRECL? RECFM?
Show some sample records...
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Tue Aug 18, 2009 12:02 pm
Reply with quote

Also the position, length and dataformat of the keys on which the comparison is to be performed.
Back to top
View user's profile Send private message
dkarthikreddy

New User


Joined: 14 Mar 2008
Posts: 28
Location: bangalore

PostPosted: Tue Aug 18, 2009 12:06 pm
Reply with quote

RECFM=FB
LRECL=15 bytes

The file record length is 80 bytes and the first 15 bytes is relevant to us.

eg: 111111111111111 ( 15 bytes)

(1,15,CH,A)
Back to top
View user's profile Send private message
Pankaj Shrivastava
Currently Banned

New User


Joined: 24 Jul 2009
Posts: 51
Location: Pune

PostPosted: Tue Aug 18, 2009 12:12 pm
Reply with quote

If just for testing , Can use Superce .If want comparison on specific column ,Then compare on coulm number (E option: CMPCOLM
) , Need JCl ..execute in batch .
Back to top
View user's profile Send private message
Escapa

Senior Member


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

PostPosted: Tue Aug 18, 2009 12:18 pm
Reply with quote

Check solution given by Anuj at below thread...
www.ibmmainframes.com/about23191.html

In this only
Output1= Non-matching records only in in-file1 not in in-file2
i.e. missing in second file....
is useful for you.
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Tue Aug 18, 2009 1:17 pm
Reply with quote

dkarthikreddy,

You can give this a try.
Code:
//STEP1  EXEC PGM=SYNCTOOL                   
//TOOLMSG  DD SYSOUT=*                       
//DFSMSG   DD SYSOUT=*                       
//IN       DD DSN= Input-file1               
//         DD DSN= Input-file2               
//OUT      DD DSN= Output-file               
//TOOLIN   DD *                             
  SELECT FROM(IN) TO(OUT) ON(1,15,CH) NODUPS
Back to top
View user's profile Send private message
dkarthikreddy

New User


Joined: 14 Mar 2008
Posts: 28
Location: bangalore

PostPosted: Tue Aug 18, 2009 1:40 pm
Reply with quote

hey "arcvns" it worked out. i got the odd record

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

Senior Member


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

PostPosted: Tue Aug 18, 2009 2:29 pm
Reply with quote

Quote:
i got the odd record

What if your first file doesnt have account number and it is present in second?
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Tue Aug 18, 2009 2:37 pm
Reply with quote

dkarthikreddy wrote:
hey "arcvns" it worked out. i got the odd record

Thanks a lot to all.
You're welcome. Note that the above job extracts 'odd records' from file-2 also if there are any.
Back to top
View user's profile Send private message
dkarthikreddy

New User


Joined: 14 Mar 2008
Posts: 28
Location: bangalore

PostPosted: Tue Aug 18, 2009 2:39 pm
Reply with quote

I wil put the second file as first file icon_lol.gif

Ok jokes apart... definitely the odd record present in second file would have resulted as odd record
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Tue Aug 18, 2009 2:40 pm
Reply with quote

Sambhaji,

Solution from Arun will take care about that, are you thinking otherwise?
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Tue Aug 18, 2009 3:00 pm
Reply with quote

I'm seriously thinking to get my key-baord changed, aarghhh..three replies before I could comment on what I wanted to... icon_redface.gif
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Tue Aug 18, 2009 3:03 pm
Reply with quote

Anuj Dhawan wrote:
I'm seriously thinking to get my key-baord changed, aarghhh..three replies before I could comment on what I wanted to... icon_redface.gif

LOL - it's the C2K interface that needs replacing icon_lol.gif
Back to top
View user's profile Send private message
Escapa

Senior Member


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

PostPosted: Tue Aug 18, 2009 3:17 pm
Reply with quote

dkarthikreddy
wrote:

I wil put the second file as first file

Ok jokes apart... definitely the odd record present in second file would have resulted as odd record

I didn't ask to change the order...

Anuj wrote:

Solution from Arun will take care about that, are you thinking otherwise?


f1:
1
2
3
5

f2:
1
2
3
6

In this case if OP requires both 5 and 6 as missing then fine..
But I thought missing in f2 (which is asked by OP) is only 6... icon_neutral.gif
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Tue Aug 18, 2009 3:59 pm
Reply with quote

Quote:
in one file i have 171 records and in another file i have the same set of acct numbers but the count here is 170
Per this statement, only one record is missing...
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
This topic is locked: you cannot edit posts or make replies. Construct new record using specific f... DFSORT/ICETOOL 6
No new posts Merge files with a key and insert a b... DFSORT/ICETOOL 6
No new posts SMF Record Date conversion failing CLIST & REXX 1
No new posts COBOL program logic for comparisipn o... COBOL Programming 2
No new posts Split a record with data in a differe... DFSORT/ICETOOL 8
Search our Forums:

Back to Top