Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

need unpaired and matched records from File-1
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Tue Aug 06, 2013 9:02 pm    Post subject: need unpaired and matched records from File-1
Reply with quote

Hi,

I have two files (LRECL=16,RECFM=FB) and requirement is to get unpaired records from file-1 (detail records) and matched records also from file-1 (header and trailer).

File-1:
Code:

HEADER  00000136
XXXXA   tb9 CUPA
XXXXA   S1T SCAL
XXXXA   F8C WHOM
TRAILER


File-2:
Code:

HEADER  00000136
XXXXA   D9J CYCL
XXXXA   O6C CLER
XXXXA   tb9 CUPA
TRAILER


I wrote below sort card -
Code:

//SYSIN    DD  *                   
  JOINKEYS FILE=F1,FIELDS=(1,16,A)
  JOINKEYS FILE=F2,FIELDS=(1,16,A)
  JOIN UNPAIRED,F1,ONLY           
  SORT FIELDS=COPY                 
  END                             


and got two reords from file-1
Code:

XXXXA   S1T SCAL
XXXXA   F8C WHOM


but my desired output should appear as given below -

Code:

HEADER  00000136
XXXXA   S1T SCAL
XXXXA   F8C WHOM
TRAILER


How to get this? Please help.
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7228

PostPosted: Tue Aug 06, 2013 10:29 pm    Post subject: Reply to: need unpaired and matched records from File-1
Reply with quote

Some work, that's how :-)

You have "groups" of data, which have "keys within a group"?

Are the the keys witing a group both unique across your data and solely contiguous within the group. Ie, when you SORT on 1,16, are any records from on group going to be mixed in with another. Is it possible?

Are the HEADERs for the groups on the two files always identical for a group?

Do the TRAILERs simply contain the word TRAILER, or some other "constant" value, or what?
Back to top
View user's profile Send private message
mistah kurtz

Active User


Joined: 28 Jan 2012
Posts: 268
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Wed Aug 07, 2013 11:10 am    Post subject:
Reply with quote

Quote:
to get unpaired records from file-1 (detail records) and matched records also from file-1 (header and trailer).

I'm sorry, but I didn't fully understand this part. Do you mean you need all the unpaired records from File1 with Header and Trailer. What if File1 and File2 have some matching records apart from Header and Trailer?
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Wed Aug 07, 2013 11:24 am    Post subject:
Reply with quote

What you could do is something like below untested though

Code:
//SYSIN    DD  *                   
  JOINKEYS FILE=F1,FIELDS=(1,16,A)
  JOINKEYS FILE=F2,FIELDS=(1,16,A)
  JOIN UNPAIRED,F1,F2
  REFORMAT FIELDS=(F1:1,16,F2:1,16)
  INCLUDE COND=((1,16,CH,EQ,17,16,CH,AND,(1,7,CH,EQ,C'HEADER ',
  OR,1,7,CH,EQ,C'TRAILER')),OR,(17,16,CH,EQ,C' '))
  END           
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Wed Aug 07, 2013 1:41 pm    Post subject: Reply to: need unpaired and matched records from File-1
Reply with quote

Pandora-box, thank you.....I got expected results.
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Wed Aug 07, 2013 1:45 pm    Post subject:
Reply with quote

Ramsri,

Would you mind sharing the solution?
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7228

PostPosted: Wed Aug 07, 2013 4:53 pm    Post subject: Reply to: need unpaired and matched records from File-1
Reply with quote

Ramsri, as with your previous topic, I'm surprised you've got the results you want other than with the very limited data you've shown.

We're getting very good at solving your problems, we just have no clue as to how we do it :-)
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Wed Aug 07, 2013 5:23 pm    Post subject: Re: Reply to: need unpaired and matched records from File-1
Reply with quote

Bill Woodger wrote:
We're getting very good at solving your problems, we just have no clue as to how we do it :-)
icon_biggrin.gif I thought the same Bill
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Wed Aug 07, 2013 5:23 pm    Post subject:
Reply with quote

Quote:
We're getting very good at solving your problems, we just have no clue as to how we do it :-)


But frankly I was able to decrypt what he wanted icon_biggrin.gif

Edit : And yes I was expecting TS to tweek my post slightly icon_eek.gif
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Wed Aug 07, 2013 5:33 pm    Post subject:
Reply with quote

Pandora-Box wrote:
But frankly I was able to decrypt what he wanted icon_biggrin.gif

Edit : And yes I was expecting TS to tweek my post slightly icon_eek.gif
Pandora,

We can very well provide solutions to the example data provided, but most of the time, it may not be realistic. Say for example, the HEADER/TRAILER records may not exactly be the same in the real input files. So the solution provided should be based on realistic data capable of handling all input scenarios. That is the whole idea behind asking questions and nothing was answered here. Any solution provided without knowing the characteristics of real data would be solely based on assumptions and cannot be expected to work as intended.
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Wed Aug 07, 2013 5:41 pm    Post subject:
Reply with quote

Arun,

I was mentioning about "tweek" for considering the files as SORTED.

Anyway apologies for providing a half-baked solution icon_redface.gif
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Wed Aug 07, 2013 6:05 pm    Post subject: Reply to: need unpaired and matched records from File-1
Reply with quote

Arun/Bill, I must admit that I changed starting letter to be O instead of X when tried it in reality.... icon_redface.gif Otherwise, I was ending up getting in wrong results icon_cry.gif

icon_idea.gif I added
Code:
OUTREC FIELDS=(1,16)
to Pandora's solution.

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

Moderator


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

PostPosted: Wed Aug 07, 2013 7:55 pm    Post subject:
Reply with quote

ramsri wrote:
I changed starting letter to be O instead of X when tried it in reality
I have no clue on what this is about. Anyways does n't matter as you have got your card working!

I would say a JOIN UNPAIRED,F1 would have been sufficient.

Or possibly even a JOIN UNPAIRED,F1,ONLY, but I can only guess with the limited info provided so far.
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Thu Aug 08, 2013 11:45 am    Post subject:
Reply with quote

Quote:
I would say a JOIN UNPAIRED,F1 would have been sufficient.

Or possibly even a JOIN UNPAIRED,F1,ONLY, but I can only guess with the limited info provided so far.


Just curious How do you get the header and Trailer?
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Thu Aug 08, 2013 1:21 pm    Post subject:
Reply with quote

Pandora,

Code:
INCLUDE COND=(1,7,SS,EQ,C'HEADER ,TRAILER',OR,.....
This will extract the header and trailer records into output if you are doing a JOIN,UNPAIRED,F1. But you need to add logic to retain the order of header and trailer records. The 'solution' provided does not handle this.

Or if the header and trailer records have static data, we can have a JOIN UNPAIRED,F1,ONLY and hard-code the header and trailer records using OUTFIL HEADER1/TRAILER1.

But with the OP ignoring all the questions/details requested, one can only guess.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7228

PostPosted: Thu Aug 08, 2013 1:42 pm    Post subject: Reply to: need unpaired and matched records from File-1
Reply with quote

Yes Arun. As this shows:

Quote:
I must admit that I changed starting letter to be O instead of X when tried it in reality...


Only by changuing the first X in the sample data to an O did the solution "work", as otherwise the TRAILER would appear before the data.

Ramsri, you will never get that to work with more than one group of data, or unless all you data starts with characters less than the trailer does.

We haven't even got to ask you if you want to retain the order of data within the group.
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Thu Aug 08, 2013 2:03 pm    Post subject:
Reply with quote

Ok I get that Arun

Thanks for the clarification
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Sun Aug 11, 2013 10:12 am    Post subject: Reply to: need unpaired and matched records from File-1
Reply with quote

Bill/Arun, there are no multiple groups within this file. There is always one header and trailer with detail records in between. I wonder if it is still achievable if the starting letter is some B or P.

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

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Aug 12, 2013 2:52 am    Post subject:
Reply with quote

Hello,

What happened when you tried?

If you have not tried, do so and post the results if there is a question/problem.
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Mon Aug 12, 2013 6:04 pm    Post subject:
Reply with quote

Bill Woodger wrote:
Are the HEADERs for the groups on the two files always identical for a group?

Do the TRAILERs simply contain the word TRAILER, or some other "constant" value, or what?
Ramsri,

Do you find it difficult to answer to all of these?
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us