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
 

 

Job to Merge the contents of a member in 2 PDS

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
rkpyla

New User


Joined: 22 Mar 2007
Posts: 5
Location: Bangalore

PostPosted: Tue Jul 15, 2008 1:18 pm    Post subject: Job to Merge the contents of a member in 2 PDS
Reply with quote

Hi,

Can anybody please help me with SYNCTOOL Job for following requirement:

I have 2 input datasets (PDS) which may or may not have members in common.

If a member is present in both the PDS, the Job should place the contents of first PDS member on top of the contents of second PDS member and copy it to output PDS.

Ex:

Input PDS1 - ID.CTL1
Input PDS2 - ID.CTL2
Output PDS - ID.CTL3

Common member in both PDS - MEMBER1

ID.CTL1(MEMBER1):

// DD DSN=ID.FIX1(FIXMEM1),DISP=SHR

ID.CTL2(MEMBER1):

// DD DSN=ID.FIX2(FIXMEM2),DISP=SHR

The job should provide the output as follows:

ID.CTL3(MEMBER1):

// DD DSN=ID.FIX1(FIXMEM1),DISP=SHR
// DD DSN=ID.FIX2(FIXMEM2),DISP=SHR


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

expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue Jul 15, 2008 1:25 pm    Post subject:
Reply with quote

Quote:
If a member is present in both the PDS, the Job should place the contents of first PDS member on top of the contents of second PDS member and copy it to output PDS.

Do you mean over write the contents of PDS2 ?

What other processing considerations should there be, member exists in PDS 1 but not PDS 2 and vise versa
Back to top
View user's profile Send private message
rkpyla

New User


Joined: 22 Mar 2007
Posts: 5
Location: Bangalore

PostPosted: Tue Jul 15, 2008 1:32 pm    Post subject: Reply to: Job to Merge the contents of a member in 2 PDS
Reply with quote

Hi,

The contents of input datasets should not be changed. Both the contents should be merged (in a temporary dataset) and copy it to output PDS.

And if the member is not common in datastes...provide a report of such members.

Thanks,
RK
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10210
Location: italy

PostPosted: Tue Jul 15, 2008 1:51 pm    Post subject: Reply to: Job to Merge the contents of a member in 2 PDS
Reply with quote

the best approach would be...

use ispf superc to compare the directories for matched and not_matched entries

process the superc output in order to
build a IEBCOPY jcl to run the copy from PDS1 to PDS3 for matched entries

Quote:
the Job should place the contents of first PDS member on top of the contents of second PDS

I do not see the PDS2 member content involved at all
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue Jul 15, 2008 2:12 pm    Post subject:
Reply with quote

Enrico, I believe that the OP means to concatenate the two members, rather than place one on top of the other icon_rolleyes.gif

Quote:

ID.CTL3(MEMBER1):

// DD DSN=ID.FIX1(FIXMEM1),DISP=SHR
// DD DSN=ID.FIX2(FIXMEM2),DISP=SHR


To be honest, I am not sure that SORT would be the best tool for this requirement, but no doubt Frank will prove me wrong icon_smile.gif
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10210
Location: italy

PostPosted: Tue Jul 15, 2008 2:15 pm    Post subject: Reply to: Job to Merge the contents of a member in 2 PDS
Reply with quote

Hi Expat,
whatever he meant, it does not look like the process can be done by a simple ICETOOL job

let' s wait for a clarification icon_confused.gif
Back to top
View user's profile Send private message
rkpyla

New User


Joined: 22 Mar 2007
Posts: 5
Location: Bangalore

PostPosted: Tue Jul 15, 2008 2:31 pm    Post subject: Reply to: Job to Merge the contents of a member in 2 PDS
Reply with quote

Hi All,

Thanks for your inputs.

This request is for a job that concatenates the contents of the common member in 2 PDS.

ID.CTL3(MEMBER1):

// DD DSN=ID.FIX1(FIXMEM1),DISP=SHR
// DD DSN=ID.FIX2(FIXMEM2),DISP=SHR

Please note that its not mandatory that the job should use ICETOOL.

Thanks,
RK
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: Tue Jul 15, 2008 9:43 pm    Post subject:
Reply with quote

Quote:
To be honest, I am not sure that SORT would be the best tool for this requirement, but no doubt Frank will prove me wrong


No, you're not wrong. DFSORT/ICETOOL only deals with a pds(member) as a sequential data set. It does NOT do anything with comparing/matching multiple members of a PDS.

Kolusu is better at this sort of thing then I am and might be able to come up with a way to do it, but he's in class today.
Back to top
View user's profile Send private message
Bill Dennis

Active Member


Joined: 17 Aug 2007
Posts: 562
Location: Iowa, USA

PostPosted: Wed Jul 16, 2008 12:58 am    Post subject:
Reply with quote

Combining the data in PDS members is not easy. I wrote my own BPAM access method program to do this.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Wed Jul 16, 2008 12:42 pm    Post subject:
Reply with quote

Hi,

1. obtain a list of the members of each PDS.

2. use the ALLDUP function to select duplicate member names.

3. SUM FIELDS=NONE will give you the name of the member that needs to concatenated to produce the new member.

4. Generate the JCL using 3 as input giving something like this

Code:
//IEBGENER EXEC PGM=IEBGENER                               
//SYSUT1   DD DSN=DSN1(MEMA),DISP=SHR                       
//         DD DSN=DSN2(MEMA),DISP=SHR                       
//SYSUT2   DD DSN=DSN1(MEMA),DISP=SHR  NEW DATASET         
//SYSPRINT DD SYSOUT=*                                     
//SYSIN    DD DUMMY                                         



Gerry
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Wed Jul 16, 2008 6:04 pm    Post subject:
Reply with quote

Hi,

this might do the trick, the only issue I have, the SQZ is not yet supported with the current version of DFSORT on my system, so the member name with less than 8 bytes will generate with spaces
Code:

//**********************************************************************
//*
//STEP0001 EXEC PGM=IKJEFT01
//SYSTSPRT DD DSN=&&LISTDS,
//            DISP=(,PASS,DELETE),
//            SPACE=(TRK,(15,5),RLSE)
//SYSTSIN  DD *
  LISTDS 'CSCSGLC.PDS1' MEMBERS
  LISTDS 'CSCSGLC.PDS2' MEMBERS
/*
//*
//**********************************************************************
//*
//STEP0002 EXEC PGM=ICETOOL
//TOOLMSG  DD SYSOUT=*
//DFSMSG   DD SYSOUT=*
//IN       DD DSN=&&LISTDS,
//            DISP=(OLD,DELETE)
//T1       DD DSN=&&T1,DISP=(,PASS),SPACE=(CYL,(5,5),RLSE)
//OUT      DD DSN=&&MEMNAMES,
//            DISP=(,PASS,DELETE),
//            SPACE=(TRK,(15,5),RLSE)
//OUT      DD SYSOUT=*
//TOOLIN   DD *
  COPY FROM(IN) USING(CTL1)
  SPLICE FROM(T1) TO(OUT) WITHALL ON(55,8,CH) WITH(45,10) USING(CTL2)
/*
//CTL1CNTL DD *
  INREC IFTHEN=(WHEN=INIT,
      OVERLAY=(138:SEQNUM,8,ZD,155:6,44)),
        IFTHEN=(WHEN=(157,6,CH,EQ,C'LISTDS'),
       OVERLAY=(138:SEQNUM,8,ZD)),
        IFTHEN=(WHEN=NONE,
       OVERLAY=(146:SEQNUM,8,ZD,
                138:138,8,ZD,SUB,146,8,ZD,M11,LENGTH=8))
  OUTREC IFTHEN=(WHEN=INIT,
         BUILD=(1,4,155,44,138,8,SEQNUM,8,ZD,RESTART=(138,8)))

  OUTFIL FNAMES=T1,VTOF,BUILD=(5,60,80:X)
/*
//CTL2CNTL DD *
  SORT FIELDS=COPY
  OMIT COND=(01,5,CH,EQ,C'READY',OR,
             01,3,CH,EQ,C'END',OR,
             53,8,ZD,EQ,1,OR,
            (53,8,ZD,GT,2,AND,53,8,ZD,LT,8))
  INREC IFTHEN=(WHEN=INIT,
        BUILD=(01,44,55:45,16)),
        IFTHEN=(WHEN=(63,8,ZD,NE,2),
        BUILD=(44X,2,10,55,16))
  OUTFIL FNAMES=OUT,BUILD=(01,54)
/*
//*
//**********************************************************************
//*
//STEP0003 EXEC PGM=ICETOOL
//TOOLMSG  DD SYSOUT=*
//DFSMSG   DD SYSOUT=*
//IN       DD DSN=&&MEMNAMES,
//            DISP=(OLD,DELETE)
//ALLDUPS  DD DSN=&&ALLDUPS,
//            DISP=(,PASS,DELETE),
//            SPACE=(TRK,(15,5),RLSE)
//NONDUP   DD SYSOUT=*
//TOOLIN DD *
SELECT FROM(IN) TO(ALLDUPS) ON(46,8,CH) ALLDUPS DISCARD(NONDUP)
//*
//*
//**********************************************************************
//*
//STEP0004 EXEC  PGM=SORT
//SORTIN   DD DSN=&&ALLDUPS,
//            DISP=(OLD,DELETE)
//SORTOUT  DD DSN=&&FIRSTDUP,
//            DISP=(,PASS,DELETE),
//            SPACE=(TRK,(15,5),RLSE)
//SYSOUT DD SYSOUT=*
//SYSIN  DD *
  SORT FIELDS=(46,8,BI,A)
  SUM FIELDS=NONE
//*
//**********************************************************************
//*
//STEP0005 EXEC PGM=ICEMAN
//SYSOUT   DD SYSOUT=*
//SORTIN   DD DSN=&&FIRSTDUP,
//            DISP=(OLD,DELETE)
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *
  OPTION COPY
  OUTFIL REMOVECC,
  HEADER1=('//JOBNAME  JOB GERRY,''MERGE '',',/,
           '//             CLASS=A,         ',/,
           '//             MSGCLASS=X,      ',/,
           '//             NOTIFY=&SYSUID   ',/,
           '//*                             '),
   BUILD=(C'//MERGE    EXEC PGM=IEBGENER    ',/,
          C'//SYSPRINT DD SYSOUT=*          ',/,
          C'//SYSIN    DD DUMMY             ',/,
          C'//SYSUT1   DISP=SHR,DSN=PDS1(',46,8,38:C')',80:X,/,
          C'//         DISP=SHR,DSN=PDS2(',46,8,38:C')',80:X,/,
          C'//SYSUT2   DISP=SHR,DSN=PDS3(',46,8,38:C')',80:X,/,
          C'//*',80:X)
/*


The SORTOUT in STEP0005 is the generated JCL, at the moment it's going to SYSOUT. Also depending on the number of matches, there maybe too many steps in the generated job.

The NONDUP DD in STEP0003 will give you the mismatches.

Specify the 2 PDS's in STEP0001


Gerry
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 Jul 16, 2008 9:06 pm    Post subject:
Reply with quote

Quote:
SQZ is not yet supported with the current version of DFSORT on my system


For the record, SQZ has been available with DFSORT since April, 2006.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Thu Jul 17, 2008 11:23 pm    Post subject:
Reply with quote

rkpyla,

Here is a simplified version of Getting the desired results.

Code:

//STEP0100 EXEC PGM=IKJEFT01                                         
//SYSTSPRT DD DSN=&&L,                                               
//            DISP=(NEW,CATLG,DELETE),                               
//            SPACE=(CYL,(15,5),RLSE),                               
//            DCB=(LRECL=80,RECFM=FB,BLKSIZE=0)                     
//SYSTSIN  DD *                                                     
  LISTDS 'YOUR PDS1' MEMBERS                                 
  LISTDS 'YOUR PDS2' MEMBERS                                   
/*                                                                   
//STEP0200 EXEC PGM=ICETOOL                                         
//TOOLMSG  DD SYSOUT=*                                               
//DFSMSG   DD SYSOUT=*                                               
//IN       DD DSN=&&L,DISP=SHR                                       
//T1       DD DSN=&&T1,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)           
//OUT1     DD SYSOUT=*                                               
//OUT2     DD SYSOUT=*                                               
//TOOLIN   DD *                                                     
  COPY FROM(IN) USING(CTL1)                                         
  SELECT FROM(T1) TO(OUT1) ON(1,10,CH) LASTDUP USING(CTL2)           
//CTL1CNTL DD *                                                     
  OMIT COND=(01,3,CH,EQ,C'END')                                     
                                                                     
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD)),                 
        IFTHEN=(WHEN=(1,5,CH,EQ,C'READY'),                           
       OVERLAY=(81:SEQNUM,8,ZD)),                                   
        IFTHEN=(WHEN=NONE,                                           
       OVERLAY=(89:SEQNUM,8,ZD,                                     
                81:81,8,ZD,SUB,89,8,ZD,M11,LENGTH=8))               
                                                                     
  OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(89:SEQNUM,8,ZD,RESTART=(81,8))) 
                                                                     
  OUTFIL FNAMES=T1,OMIT=(89,8,ZD,LE,9),IFOUTLEN=10,                 
  IFTHEN=(WHEN=INIT,BUILD=(C'(',3,8,C')')),                         
  IFTHEN=(WHEN=INIT,OVERLAY=(01:01,10,SQZ=(SHIFT=LEFT)))             
/*                                                                   
//CTL2CNTL DD *                                                 
  OUTFIL FNAMES=OUT1,REMOVECC,ENDREC=250,                       
  HEADER1=('//TIDXXXXA JOB ','''','COPY''',/,                   
           '//             CLASS=A,',/,                         
           '//             MSGCLASS=Y,',/,                     
           '//             MSGLEVEL=(1,1),',/,                 
           '//             NOTIFY=&SYSUID',/,                   
           '//*'),                                             
   BUILD=(C'//STEP0',SEQNUM,3,ZD,C' EXEC PGM=IEBGENER    ',/,   
          C'//SYSPRINT DD SYSOUT=*          ',/,               
          C'//SYSIN    DD DUMMY             ',/,               
          C'//SYSUT1   DISP=SHR,DSN=PDS1',01,10,80:X,/,         
          C'//         DISP=SHR,DSN=PDS2',01,10,80:X,/,         
          C'//SYSUT2   DISP=SHR,DSN=PDS3',01,10,80:X,/,         
          C'//*',80:X)                                         
                                                               
  OUTFIL FNAMES=OUT2,REMOVECC,STARTREC=251,ENDREC=500,         
  HEADER1=('//TIDXXXXB JOB ','''','COPY''',/,                   
           '//             CLASS=A,',/,                         
           '//             MSGCLASS=Y,',/,                     
           '//             MSGLEVEL=(1,1),',/,                 
           '//             NOTIFY=&SYSUID',/,                   
           '//*'),                                             
   BUILD=(C'//STEP0',SEQNUM,3,ZD,C' EXEC PGM=IEBGENER    ',/,   
          C'//SYSPRINT DD SYSOUT=*          ',/,               
          C'//SYSIN    DD DUMMY             ',/,               
          C'//SYSUT1   DISP=SHR,DSN=PDS1',01,10,80:X,/,         
          C'//         DISP=SHR,DSN=PDS2',01,10,80:X,/,         
          C'//SYSUT2   DISP=SHR,DSN=PDS3',01,10,80:X,/,         
          C'//*',80:X)                                         
/*                                                             
                                                 


The job takes care of 500 matched duplicate member names. if you have more than that you can just code another OUTFIL statement in ctl2cntl.

Once you have verified that jcl created is correct, change the following statements

Code:

//OUT1     DD SYSOUT=*                                               
//OUT2     DD SYSOUT=* 


to

Code:

//OUT1     DD SYSOUT=(*,INTRDR)                                               
//OUT2     DD SYSOUT=(*,INTRDR)
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
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts find particular member name in PDS us... ravi243 CLIST & REXX 10 Mon Dec 19, 2016 6:44 pm
No new posts What is the command to check MODE of ... rohanthengal CLIST & REXX 7 Fri Nov 18, 2016 1:48 pm
No new posts File Stauts 92 with member of PDS sandip_mainframe COBOL Programming 4 Fri Jun 10, 2016 12:06 pm
No new posts Consolidating and summing file contents Kevin Lindsley SYNCSORT 14 Thu Jun 09, 2016 5:24 am
No new posts SQL Merge error -254 Robin Sulsona DB2 8 Wed Jun 01, 2016 8:28 pm


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