MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Selective Creation of a GDG

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL)
View previous topic :: View next topic  
Author Message
Siva Kumar Sunku
Beginner


Joined: 17 Aug 2004
Posts: 25
Topics: 14

PostPosted: Mon Oct 11, 2004 7:51 am    Post subject: Selective Creation of a GDG Reply with quote

Hi,
I have to achieve the following functionality.
1. Read a PS file. (There will be a number in the first Record of this PS file).
2. I need to write the contents of the PS file into next version of corresponding GDG.

PS contents are here -

    H02XXXXXXX
    DABCDEFGH
    DABCDEFGH

GDGs are (These are Base Versions of GDG)

    HLQ1.BM.GDG1
    HLQ1.BM.GDG2
    HLQ1.BM.GDG3

Now, Since in PS file '02' is there I need to create a new version of HLQ1.BM.GDG2.
I have a code in SELCOPY, which reads the first record of PS, and depending on that it will write the contents of PS to the particular GDG.
Selcopy (Logic of Selcopy am planning to write)
Code:

//STEP040 PGM=SELCOPY
//INPUT1 DD DSN=HLQ1.BM.INPUT1, DISP=SHR
//OUTPUT1 DD DSN=HLQ1.BM.GDG1(+1),DISP=(NEW,CATLG,DELETE)
//OUTPUT2 DD DSN=HLQ1.BM.GDG2(+1),DISP=(NEW,CATLG,DELETE)
....
//OUTPUT30 DD DSN=HLQ1.BM.GDG30(+1),DISP=(NEW,CATLG,DELETE)
//SYSIN DD *
READ INPUT
IF NUMBER = 1
  OUTDD=OUTPUT1
ELSE IF NUMBER=2
  OUTDD=OUTPUT2
......
......
ENDIF
WRITE contents in OUTDD.


Now, It will work fine. But disadvantage is all other GDG versions it will create empty versions, which I don't want.

Here my Question is, If the number is 'X' in PS file, I want to write to the new version of 'X'GDG. Rest other GDGs versions should not be affected.

Please suggest me how can I achieve this with less effort.
I have all SORT,EZYTRIEVE and SELCOPY in my shop.

Thanks
Siva.[/quote]
Back to top
View user's profile Send private message AIM Address
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Mon Oct 11, 2004 8:14 am    Post subject: Reply with quote

Siva,

It is a very simple task. Generate a dynamic JCL and submit the JCL via Intrdr to copy the contents of the seq file.

The following JCL will give you the desired results. First we read the first record of the PS file. Now using a change command on the outrec fields, we change the number to corresponding file number. And using OUTFIL OUTREC we create a dynamic JCL.

Code:

//STEP0100 EXEC PGM=SORT                                       
//SYSOUT   DD SYSOUT=*                                         
//SORTIN   DD *                                               
H02XXXXXXX                                                     
DABCDEFGH                                                     
DABCDEFGH                                                     
//SORTOUT  DD SYSOUT=*                                         
//SYSIN    DD *                                               
  SORT FIELDS=COPY,STOPAFT=1                                   
  OUTREC FIELDS=(2,2,CHANGE=(20,C'01',C'HLQ1.BM.GDG1,',       
                                C'02',C'HLQ1.BM.GDG2,',       
                                C'03',C'HLQ1.BM.GDG3,',       
                                C'04',C'HLQ1.BM.GDG4,'),       
                             NOMATCH=(C'SOME SEQ FILE NAME,'))
  OUTFIL OUTREC=(C'//USERIDZ  JOB ',X'7D',C'CREATE DSN',X'7D',
                 C',CLASS=A,',/,                               
                 C'//',13X,C'MSGCLASS=Y,MSGLEVEL=(1,1),',/,   
                 C'//',13X,C'NOTIFY=&SYSUID',/,               
                 C'//*',/,                                     
                 C'//STEP0100 EXEC PGM=SORT',/,               
                 C'//SYSOUT   DD SYSOUT=*',/,                 
                 C'//SORTIN   DD DSN=HLQ1.BM.INPUT1,',/,       
                 C'//            DISP=SHR',/,                 
                 C'//SORTOUT  DD DSN=',1,20,/,                 
                 C'//            DISP=(NEW,CATLG,DELETE),',/, 
                 C'//            UNIT=SYSDA,',/,               
                 C'//            SPACE=(CYL,(X,Y),RLSE)',/,   
                 C'//SYSIN    DD *',/,                         
                 C'  SORT FIELDS=COPY',/,                     
                 C'/*',80:X)                                   
/*


The output from this job will be as follows.

Code:

//USERIDZ  JOB 'CREATE DSN',CLASS=A,             
//             MSGCLASS=Y,MSGLEVEL=(1,1),       
//             NOTIFY=&SYSUID                   
//*                                             
//STEP0100 EXEC PGM=SORT                         
//SYSOUT   DD SYSOUT=*                           
//SORTIN   DD DSN=HLQ1.BM.INPUT1,               
//            DISP=SHR                           
//SORTOUT  DD DSN=HLQ1.BM.GDG2,                 
//            DISP=(NEW,CATLG,DELETE),           
//            UNIT=SYSDA,                       
//            SPACE=(CYL,(X,Y),RLSE)             
//SYSIN    DD *                                 
  SORT FIELDS=COPY                               
/*       


Once you have verified that the generated JCL is right , change the SORTOUT to the following

Code:

//SORTOUT   DD SYSOUT=(*,INTRDR)


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL) All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group