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
 

 

How to copy first n generations into a single file?

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

Active User


Joined: 31 Mar 2010
Posts: 132
Location: India

PostPosted: Mon May 17, 2010 3:05 pm    Post subject: How to copy first n generations into a single file?
Reply with quote

Hi,

If a GDG has n generations (where n > 20). How to copy first 20 versions into a single file?
Actually my requirement is, Job A runs twice a day and is capable of processing 20 files at a time.
If input GDG has 30 generations, first run of Job A should process first 20 generations and delete the processed files. second run of Job A should process second set of 10 generations.

For example:

In the below case, Job A when it runs for the first time, it should copy G0001V00 - G0020V00 to a single file. Second run should copy G0021V00 - G0040V00 .

AAA.BBB.CCC.G0001V00
AAA.BBB.CCC.G0002V00
.
.
.
AAA.BBB.CCC.G00020V00
.
.
AAA.BBB.CCC.G0030V00

Can anybody please tell me how to do this as number of generations are changing dynamically and total number of generations present at some time are not known in advance?
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: Mon May 17, 2010 3:48 pm    Post subject: Reply to: How to copy first n generations into a single file
Reply with quote

Let's see if I got this.

You want to:

- Use LISTCAT to determine ALL of the existing generations.
- Sort that list by dataset name, in ascending order, limiting the output to the first 20 (or less) generations.
- Build the list of required DD statements for the subsequent job, all with DISP=(OLD,DELETE).
- Submit that job.
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: Mon May 17, 2010 3:53 pm    Post subject:
Reply with quote

OK, let's take a stroll down "crazy requirements lane".

Why not just process the whole GDG base in one hit. Why the requirement for 20 gens.
Back to top
View user's profile Send private message
GaganGarg

Active User


Joined: 31 Mar 2010
Posts: 132
Location: India

PostPosted: Mon May 17, 2010 4:04 pm    Post subject:
Reply with quote

Hi,

Quote:


Why not just process the whole GDG base in one hit. Why the requirement for 20 gens?



This is our project requirement. during the first run of the job in a day, we have to process first 20 gens, if existing.

@ Superk,

Yeah exactly i want the same thing what you have mentioned.

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

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon May 17, 2010 4:37 pm    Post subject:
Reply with quote

same reason that the sysout from step 1 has to come from step 1.

standards, rule, regulations.
come on now! everybody get in step, just to get in step!!

It must be comforting for creators of inflexible standards to know that
no one will ever question anything.
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: Mon May 17, 2010 4:51 pm    Post subject:
Reply with quote

Hey Dick, Maybe we should say it's a project requirement to receive 20 euros per post that we make.

Anyway, going back to Kevins' solution, using IGGCSIRX returns the generations in order,so removes the need to sort them.

In fact, it can all be done within the same REXX exec, the generation part and the copy part.
Back to top
View user's profile Send private message
GaganGarg

Active User


Joined: 31 Mar 2010
Posts: 132
Location: India

PostPosted: Mon May 17, 2010 5:13 pm    Post subject:
Reply with quote

If the requirement seems to be crazy, sorry for this. But it was the requirement so i raised my query. Superk got exactly what i wanted. I wanted to do it in a JCL so i wanted to know how to create the DD statements dynamically for input GDG generations without using the REXX.
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 May 17, 2010 8:27 pm    Post subject:
Reply with quote

Hello,

Quote:
If the requirement seems to be crazy
The "requirement" is not really a requirement. . . It is a rather poor excuse of a way to meet some requirement (as yet not posted).

Requirements come in 2 flavors - user requirements and technical requirements. This is neither - it is just what someone decided needs to be done.

If you proceed in this direction be ready to "fight fires" of missing or duplicated data periodically. What should happen when a "middle" generation is deleted between runs? What should happen when there are more than 40 generations ctaloged? And on and on. . .
Back to top
View user's profile Send private message
GaganGarg

Active User


Joined: 31 Mar 2010
Posts: 132
Location: India

PostPosted: Tue May 18, 2010 9:50 am    Post subject:
Reply with quote

Hi Dick,

Actually the job is required to process only 20 versions. This job is used for some billing purposes. we want to execute the job for 20 gens only. suppose a GDG is having 50 gens at some time then first run of this job shud pick 20 generations and delete these 20 generations, next run should also pick 20 generations and so on. suppose GDG is having 35 generations attached to it then first run should pick 20 generations and 2nd run should pick 15 generations. GDG generations won't have duplicates and as no other job will be processing these generations so no middel gen will get deleted, we want to delete only those gens whatever are processed.
Thanks
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue May 18, 2010 2:23 pm    Post subject:
Reply with quote

GaganGang,

The question still remains: Why is the job required to only process 20 gens?

why can't it process 21, or 121? What is so magical about 20?
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 May 18, 2010 7:29 pm    Post subject:
Reply with quote

Hello,

Once upon a time i had a system that received this kind of info from 322 distribution and point-of-sale warehouses every day (sometimes more than one a day). Each input was cataloged as a +1 generation. Twice a day the entire gdg was read, copied, and processed and the cataloged entries deleted.

Why do you believe you need this "magic break" at 20?
Back to top
View user's profile Send private message
GaganGarg

Active User


Joined: 31 Mar 2010
Posts: 132
Location: India

PostPosted: Wed May 19, 2010 9:23 am    Post subject:
Reply with quote

First run of the job(that will process the GDG gens) will be kicked when there will be 20 gens of the GDG. so there was the need to process the 20 gens only.

And, now there is a change in the requirements. now, we have to process the 20 gens only everytime( not less than 20). so job processing the GDG gens will be kicked as long as the 20th gen is created.

We have created a jcl to process these 20 gens. please find below the jcl:


Code:

//****************************************
//* ****** LIST ALL THE VERSIONS *********
//****************************************
//STEP01   EXEC  PGM=IDCAMS
//SYSPRINT DD DSN=XXXXXX.GDG.LIST,
//            DISP=(MOD,CATLG,DELETE),UNIT=SYSDA,
//            SPACE=(CYL,(10,10),RLSE)
//SYSIN    DD  *
  LISTC LVL(XXXXXX.GDG.TEST) ALL
/*
//*******************************************
//* ***** EXTRACT THE FIRST 20 VERSIONS ******
//*******************************************
//STEP02   EXEC  PGM=SORT
//SYSOUT   DD  SYSOUT=*
//SORTIN   DD  DSN=XXXXXX.GDG.LIST,
//             DISP=SHR
//SORTOUT  DD  DSN=XXXXXX.GDG.REPRO,
//            DISP=(NEW,CATLG,DELETE),UNIT=SYSDA,
//            SPACE=(CYL,(10,10),RLSE),
//            LRECL=80,RECFM=FB
//SYSIN    DD  *
  SORT FIELDS=COPY,STOPAFT=20
  INCLUDE COND=(6,7,CH,EQ,C'NONVSAM')
  OUTFIL OUTREC=(1:C'   REPRO IDS(',14:21,25,40:C') OFILE(SYSUT2)',
                80:C' '),CONVERT
/*
//**************************************************************
//* *** COPY THE DATA FROM FIRST 20 VERSIONS TO A SINGLE FILE ***
//**************************************************************
//STEP03 EXEC PGM=IDCAMS
//SYSUT2  DD  DSN=XXXXXX.GDG.MERGE,DISP=(MOD,CATLG),
//         RECFM=FB,LRECL=80,
//         UNIT=SYSDA,SPACE=(CYL,(10,10),RLSE)
//SYSPRINT DD SYSOUT=*
//SYSIN    DD DSN=XXXXXX.GDG.REPRO,DISP=SHR


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

Active User


Joined: 31 Mar 2010
Posts: 132
Location: India

PostPosted: Wed May 19, 2010 11:25 am    Post subject:
Reply with quote

Before the requirement change, we had developed the jcl as given below:

Code:

//***********************************************************           
//*         DELETE PREVIOUS DATASET                         *           
//***********************************************************           
//IEFBR14A EXEC PGM=IEFBR14                                             
//DEL001   DD DSN=OPERA12.TEST.FILE123,                                 
//            DISP=(MOD,DELETE,DELETE),                                 
//            SPACE=(TRK,0)                                             
//SYSOUT   DD SYSOUT=*                                                 
//SYSPRINT DD SYSOUT=*                                                 
//SYSUDUMP DD SYSOUT=Z                                                 
//***********************************************************           
//*         LIST THE MEMBERS OF GDG                         *           
//***********************************************************           
//IKJEFT01 EXEC PGM=IKJEFT01                                           
//SYSTSPRT DD DSN=&&LIST1,                                             
//            DISP=(NEW,PASS,DELETE),                                   
//            SPACE=(TRK,(5,5),RLSE),                                   
//            DCB=(RECFM=FB,LRECL=133)                                 
//SYSPRINT DD SYSOUT=*                                                 
//SYSIN    DD DUMMY                                                     
//SYSTSIN  DD *                                                         
 LISTC ENT('GDG BASE NAME')                               
/*                                                                     
//**********************************************************************
//* SORT1   - STEP WHICH WILL GET THE GDG GEN NAMES                    *
//**********************************************************************
//SORT1 EXEC PGM=SORT                                                   
//SYSPRINT DD SYSOUT=*                                                 
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD DSN=&&LIST1,                                             
//            DISP=SHR                                                 
//SORTOUT  DD DSN=OPERA12.TEST12.PDS123(TEST),                         
//            DISP=SHR                                                 
//SYSIN DD *                                                           
  INCLUDE COND=(4,7,SS,EQ,C'NONVSAM')                                   
  SORT FIELDS=COPY                                                     
  OUTREC BUILD=(1:17,44,73:SEQNUM,8,ZD)                                 
/*                                                                     
//**********************************************************************
//* SORT2   -  STEP WHICH WILL CREATE THE SYSUT1 DYNAMICALLY IN MEMBER *
//*            TEST1                                                   *
//**********************************************************************
//SORT2 EXEC PGM=SORT                                                   
//SYSPRINT DD SYSOUT=*                                                 
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD DSN=OPERA12.TEST12.PDS123(TEST),                         
//            DISP=SHR                                                 
//SORTOUT  DD DSN=OPERA12.TEST12.PDS123(TEST1),                         
//            DISP=SHR                                                 
//SYSIN DD *                                                           
  INREC IFTHEN=(WHEN=(73,8,ZD,EQ,+1),                                   
      BUILD=(1:C' //SYSUT1 DD DSN=',1,44,C',DISP=(OLD,DELETE)',80:X)), 
         IFTHEN=(WHEN=(NONE),                                           
      BUILD=(1:C' //       DD DSN=',1,44,C',DISP=(OLD,DELETE)',80:X))   
  SORT FIELDS=COPY                                                     
  OUTFIL FNAMES=SORTOUT,ENDREC=20,                                     
         BUILD=(1:1,17,18:18,62,SQZ=(SHIFT=LEFT),80:X)                 
/*                                                                     
//**********************************************************************
//* SORT3   -  STEP WHICH CREATES THE JCL TO MERGE THE GDG GENS        *
//**********************************************************************
//SORT3 EXEC PGM=SORT                                                   
//SYSPRINT DD SYSOUT=*                                                 
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD *                                                         
 //OPERA12J JOB (TST,1),'TEST',                                     
 //             CLASS=T,                                               
 //             MSGCLASS=X,                                             
 //             MSGLEVEL=(1,1),                                         
 //             NOTIFY=&SYSUID                                         
 //*                                                                   
 //IEBGEN01 EXEC PGM=IEBGENER                                           
//         DD DSN=OPERA12.TEST12.PDS123(TEST1),                         
//            DISP=SHR                                                 
//         DD *                                                         
 //SYSUT2   DD DSN=OPERA12.TEST.FILE123,                               
 //            DISP=(NEW,CATLG,DELETE),                                 
 //            DCB=*.SYSUT1,                                           
 //            SPACE=(CYL,(4,4),RLSE),                                 
 //            AVGREC=U,VOL=(,,,59)                                     
 //SYSOUT   DD SYSOUT=*                                                 
 //SYSIN    DD DUMMY                                                   
 //SYSPRINT DD SYSOUT=*                                                 
 //SYSUDUMP DD SYSOUT=*                                                 
//SORTOUT  DD DSN=OPERA12.TEST12.PDS123(TEST2),                         
//            DISP=SHR                                                 
//SYSIN DD *                                                           
  SORT FIELDS=COPY                                                     
  OUTREC BUILD=(1:2,71,9X)                                             
/*                                                                     
//**********************************************************************
//* SUBJCL  - THIS JCL IS USED FOR SUBMITTING A JCL                    *
//**********************************************************************
//SUBJCL   EXEC PGM=IKJEFT01                                           
//SYSTSPRT DD SYSOUT=*                                                 
//SYSTSIN  DD *                                                         
 SUB 'OPERA12.TEST12.PDS123(TEST2)'                                     
//*                                                                     
//SYSPRINT DD  SYSOUT=*                                                 
//SYSOUT   DD  SYSOUT=*                                                 
//SYSUDUMP DD  SYSOUT=*                                                 
//**********************************************************************
//* END OF THE JCL                                                     
//**********************************************************************


Here, we had used ENDREC, so even if the number of gens were less than 20 (before the requirement change, we may had to process less than 20 gens) , it could run the job successfully.
Thanks
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 syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am
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 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