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
 

 

Merging Datasets

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
rgupta71

Active User


Joined: 21 Jun 2009
Posts: 160
Location: Indore

PostPosted: Tue Feb 01, 2011 9:42 pm    Post subject: Merging Datasets
Reply with quote

Hi All,

I have the following requirement
I have five datasets all having RECFM=FB and LRECL=213.
File has error description at first 30 bytes and rest of it is data.
ex
File1
Code:
Error1                            Record1
                                     Record2
                                     Record3
                                     Record4
Error2                            Record1
                                     Record2

File2
Code:
Error1                            Record5
                                     Record6
                                     Record7
                                     Record8
Error2                            Record7
                                     Record9

Output
Code:
Error1                            Record1
                                     Record2
                                     Record3
                                     Record4
                                     Record5
                                     Record6
                                     Record7
                                     Record8
Error2                            Record1
                                     Record2
                                     Record7
                                     Record9

There can be any number of errors.If any record is present in file 1 it will not be in file-2.

Can we do this using sort?

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

rgupta71

Active User


Joined: 21 Jun 2009
Posts: 160
Location: Indore

PostPosted: Tue Feb 01, 2011 9:52 pm    Post subject:
Reply with quote

All the records start at 32nd position.
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Tue Feb 01, 2011 9:53 pm    Post subject: Reply to: Merging Datasets
Reply with quote

rgupta71, a merge requires that all of the input datasets are already sorted in ascending order on the merging key, i.e. in your case the first 30 bytes. Then, the MERGE command combines all of the records based on that key. I have a suspicion that a MERGE is not what you're looking for here.
Back to top
View user's profile Send private message
rgupta71

Active User


Joined: 21 Jun 2009
Posts: 160
Location: Indore

PostPosted: Tue Feb 01, 2011 10:19 pm    Post subject:
Reply with quote

We can sort it based on error.It is not a problem.
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: Tue Feb 01, 2011 10:42 pm    Post subject:
Reply with quote

Hello,

Quote:
We can sort it based on error.It is not a problem.
If you can sort it on error, you can merge it. . .

You need to use the "Code" tag when posting. All you need is copy/paste frm the terminal and "Code" the info in the reply editor. Do not add spaces as this mis-aligns your data.
Back to top
View user's profile Send private message
rgupta71

Active User


Joined: 21 Jun 2009
Posts: 160
Location: Indore

PostPosted: Tue Feb 01, 2011 10:58 pm    Post subject:
Reply with quote

If I sort the data all the records which have blank in the first 30 byte will come at end.

How I will I determine that which record was for which error?
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: Tue Feb 01, 2011 11:53 pm    Post subject:
Reply with quote

Hello,

Quote:
If I sort the data all the records which have blank in the first 30 byte will come at end.

The blanks will be first not last - this is not a pc. . .

You said it was no problem and that you could sort it based on error. . .

A process is needed that propogates the "error" value to the uncoded records in both files, then merge these suppressing the error code in records 2 thru n for each output group.

What should happen if either/both iput files contain duplicates?
Back to top
View user's profile Send private message
rgupta71

Active User


Joined: 21 Jun 2009
Posts: 160
Location: Indore

PostPosted: Wed Feb 02, 2011 12:07 am    Post subject:
Reply with quote

Same error can be present in both the files but every record field will be only in one file.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Wed Feb 02, 2011 3:21 am    Post subject:
Reply with quote

If I understand what you're trying to do (and I'm not sure I do), here's a DFSORT job that will do it.

Code:

//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=...  input file1 (FB/213)
//IN2 DD DSN=...  input file2 (FB/213)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=...   output file (FB/213)
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL1)
SORT FROM(T1) TO(OUT) USING(CTL2)
/*
//CTL1CNTL DD *
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,5,CH,EQ,C'Error'),
    PUSH=(214:1,30))
/*
//CTL2CNTL DD *
  OPTION EQUALS
  SORT FIELDS=(214,30,CH,A)
  OUTREC IFOUTLEN=213,
    IFTHEN=(WHEN=GROUP,KEYBEGIN=(214,30),PUSH=(214:SEQ=8)),
    IFTHEN=(WHEN=(214,8,ZD,NE,1),OVERLAY=(1:30X))
/*
Back to top
View user's profile Send private message
rgupta71

Active User


Joined: 21 Jun 2009
Posts: 160
Location: Indore

PostPosted: Wed Feb 02, 2011 10:32 pm    Post subject:
Reply with quote

Hi Frank,
It is giving error
Code:

  OPTION EQUALS                                             
  SORT FIELDS=(214,30,CH,A)                                 
  OUTREC IFOUTLEN=213,                                       
    IFTHEN=(WHEN=GROUP,KEYBEGIN=(214,30),PUSH=(214:SEQ=8)), 
                       $                                     
OPERAND DEFINER ERROR                                       
    IFTHEN=(WHEN=(214,8,ZD,NE,1),OVERLAY=(1:30X))           
    $     
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Wed Feb 02, 2011 10:54 pm    Post subject:
Reply with quote

rgupta71,

Looks like you don't have PTF H which supports keybegin keyword. Change the OUTREC statements to the following

Code:

  OUTREC IFOUTLEN=213,                                           
  IFTHEN=(WHEN=INIT,OVERLAY=(244:SEQNUM,8,ZD,RESTART=(214,30))),   
  IFTHEN=(WHEN=(244,8,ZD,NE,1),OVERLAY=(1:30X))                 
Back to top
View user's profile Send private message
rgupta71

Active User


Joined: 21 Jun 2009
Posts: 160
Location: Indore

PostPosted: Thu Feb 03, 2011 1:04 am    Post subject:
Reply with quote

It worked. icon_biggrin.gif
My input files also has header of 5 rows icon_sad.gif .Can we handle that by modifying the same sort or I should delete the data before using this sort?

Thank you all for your support.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Thu Feb 03, 2011 1:51 am    Post subject:
Reply with quote

Sigh. That depends on which input file has the header rows and what they look like. Give details and show an example.

It would have saved time if you had described your requirement completely in the first place.
Back to top
View user's profile Send private message
rgupta71

Active User


Joined: 21 Jun 2009
Posts: 160
Location: Indore

PostPosted: Thu Feb 03, 2011 1:54 am    Post subject:
Reply with quote

Sorry Frank icon_redface.gif .
Both the input files have header of 5 rows. The example is same as above the only difference is that it has header of 5 rows.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Thu Feb 03, 2011 2:02 am    Post subject:
Reply with quote

If you need to remove the first 5 records from each input file, change CTL1CNTL to:

Code:

//CTL1CNTL DD *
  OPTION SKIPREC=5
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,5,CH,EQ,C'Error'),
    PUSH=(214:1,30))
/*
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Single COPY CICS TS datasets and when... Kyle Carroll CICS 2 Tue Oct 11, 2016 9:47 pm
No new posts Finding unreferenced datasets without... Alan Playford JCL & VSAM 5 Tue Jul 12, 2016 9:07 pm
No new posts BDW in VB datasets harisukumaran JCL & VSAM 5 Sat May 28, 2016 9:46 am
No new posts How to sync memebers in some datasets... Lord.of.Wind Compuware & Other Tools 2 Thu Apr 21, 2016 12:48 pm
No new posts Need help on FDRABR incremental backu... sanpedro All Other Mainframe Topics 6 Wed Apr 06, 2016 3:24 am


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