IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to dyanamically select a PDS file using the last qlfr?


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Shobana

New User


Joined: 22 Mar 2005
Posts: 15
Location: Chennai

PostPosted: Wed Apr 04, 2007 4:39 pm
Reply with quote

Hi,

I have a PDS (BPAA.CNTLCARD.V0610) which has some set of control cards. If there is any change in any of the member a new PDS (BPAA.CNTLCARD.V0611) will be created with the same set of members and with the changes in the respective member.

I have a jcl where they use the control card PDS with the naming convention of BPAA.CNTLCARD.&version, where they change this version manually whenever they create a new PDS.

Is there anyway with which i can get the version number automatically by checking the last qualifier of the PDS and get it dynamically selected in my jcl when it get triggers?

Regards,
Shobana
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8796
Location: Welsh Wales

PostPosted: Wed Apr 04, 2007 4:46 pm
Reply with quote

Well, all I can say is that whoever thought up the idea of constantly changing the name of a PDS each time it gets updated should perhaps look for a career outside of IT.
Back to top
View user's profile Send private message
superk

Global Moderator


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

PostPosted: Wed Apr 04, 2007 6:11 pm
Reply with quote

Shobana wrote:
Is there anyway with which i can get the version number automatically by checking the last qualifier of the PDS and get it dynamically selected in my jcl when it get triggers?


Yes, I would think you could do that. It will most likely require two jobs - one to determine and store the last name of the PDS, and then your job that uses that variable. Something maybe like this:

Code:

//STEP1    EXEC PGM=IKJEFT01                             
//SYSTSPRT DD   DSN=&&SYSTSPRT,DISP=(,PASS),             
//         UNIT=VIO,SPACE=(CYL,(1,1),RLSE)               
//SYSTSIN  DD   *                                         
LISTCAT ENT('BPAA.CNTLCARD.*')                           
/*                                                       
//*                                                       
//STEP2    EXEC PGM=ICEMAN                               
//SORTIN   DD   DSN=&&SYSTSPRT,DISP=(OLD,DELETE)         
//SORTOUT  DD   DISP=SHR,DSN=MY.PARMLIB(MYMEMB)     
//SYSOUT   DD   SYSOUT=*                                 
//SYSIN    DD   *                                         
  OPTION VLSHRT                                           
  SORT FIELDS=(22,44,CH,D)                               
  OUTFIL CONVERT,INCLUDE=(6,7,CH,EQ,C'NONVSAM'),ENDREC=3,
    OUTREC=(C'// SET THEPDS=',22,44,80:X)                 
/*                                                       
//*                                                       


where 'MY.PARMLIB(MYMEMB)' contains the line:

// SET THEPDS=BPAA.CNTLCARD.V0611

Then, your job using the variable for the PDS name:

Code:

// JCLLIB ORDER=MY.PARMLIB
// INCLUDE MEMBER=MYMEMB
//*
...
//SYSIN DD DISP=SHR,DSN=&THEPDS
Back to top
View user's profile Send private message
Shobana

New User


Joined: 22 Mar 2005
Posts: 15
Location: Chennai

PostPosted: Wed Apr 04, 2007 7:01 pm
Reply with quote

Hi,

In step1, I am getting the output as

1READY
LISTCAT ENT('BPAA.DBA.R010.CNTLCARD.*')
NONVSAM ------- BPAA.DBA.R010.CNTLCARD.V0702NT
IN-CAT --- SYS1.CRIS#.CATALOG
NONVSAM ------- BPAA.DBA.R010.CNTLCARD.V0704
IN-CAT --- SYS1.CRIS#.CATALOG
NONVSAM ------- BPAA.DBA.R010.CNTLCARD.V0706
IN-CAT --- SYS1.CRIS#.CATALOG
NONVSAM ------- BPAA.DBA.R010.CNTLCARD.V0708
IN-CAT --- SYS1.CRIS#.CATALOG
NONVSAM ------- BPAA.DBA.R010.CNTLCARD.V8TEST
IN-CAT --- SYS1.CRIS#.CATALOG
READY
END

But i didnt get anything in MY.PARMLIB(MYMEMB)

After analysing the sysin in step2 with the output of the step1, i did few changes.
//SYSIN DD *
OPTION VLSHRT
SORT FIELDS=(18,44,CH,D)
OUTFIL CONVERT,INCLUDE=(2,7,CH,EQ,C'NONVSAM'),ENDREC=3,
OUTREC=(C'// SET THEPDS=',18,44,80:X)
/*

Even though am not getting any data in the output file.
Could you please explain me the sysin, so that i can check what wud be the reason?

Regards,
Shobana
Back to top
View user's profile Send private message
superk

Global Moderator


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

PostPosted: Wed Apr 04, 2007 8:55 pm
Reply with quote

OK, the first solution was a poor one, since I didn't account for the fact that the number of datasets listed could vary. The process needs to use ICETOOL instead of SORT:

Code:

//STEP1    EXEC PGM=IKJEFT01                             
//SYSTSPRT DD   DSN=&&SYSTSPRT,DISP=(,PASS),             
//         UNIT=VIO,SPACE=(CYL,(1,1),RLSE)               
//SYSTSIN  DD   *                                         
LISTCAT ENT('BPAA.CNTLCARD.*')                           
/*                                                       
//*                                                       
//STEP2    EXEC PGM=ICETOOL
//IN       DD   DSN=&&SYSTSPRT,DISP=(OLD,DELETE)         
//T1       DD   UNIT=VIO,SPACE=(CYL,(1,1))
//OUT      DD   DISP=SHR,DSN=MY.PARMLIB(MYMEMB)     
//DFSMSG   DD   SYSOUT=*                               
//TOOLMSG  DD   SYSOUT=*                               
//TOOLIN   DD   *                                     
  SORT FROM(IN) USING(CTL1)                           
  COPY FROM(T1) USING(CTL2)                           
/*                                                     
//CTL1CNTL DD   *                                     
  OPTION VLSHRT                                       
  SORT FIELDS=(22,44,CH,D)                             
  OUTFIL FNAMES=T1,CONVERT,                           
    INCLUDE=(6,7,CH,EQ,C'NONVSAM'),                   
    BUILD=(22,44,80:X)                                 
/*                                                     
//CTL2CNTL DD   *                                     
  OUTFIL FNAMES=OUT,ENDREC=1,                         
    BUILD=(C'// SET THEPDS=',1,44,80:X)               
/*                                                     
//*                                                       
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10886
Location: italy

PostPosted: Wed Apr 04, 2007 9:37 pm
Reply with quote

Hi!

since Your organization cannot live without this setup, the easiest an consolidated way of doing it is to use the ALIAS approach.
IT means :

in Your JCl use a conventional name for example
BPAA.DBA.R010.CNTLCARD.anythingYoulike

every time the new pds is created Just run a simple IDCAMS job to create an alias too the just created dataset

Code:


//ALIAS JOB ......
//AMS EXEC PGM=IDCAMS
//SYSPRINT DD SYOUT=*
//SYSIN DD *
  DELETE BPAA.DBA.R010.CNTLCARD.anythingYoulike ALIAS
  set maxcc = 0
  DEFINE ALIAS ( -
             NAME(BPAA.DBA.R010.CNTLCARD.anythingYoulike) -
             RELATE(BPAA.DBA.R010.CNTLCARD.Vnnnnnn) )
//


the Execution job would look like
Code:


//jobname JOB ....
//s exec programname
//ddname dd disp=shr,
//                 dsn=BPAA.DBA.R010.CNTLCARD.anythingYoulike(member)
....
....


Simple and clean ! no fussing around with Your procedures
the critical events:
creating the new pds and defining the alias are concentrated in single step

regards

e.s

P.S.

it the same technique used by IBM to manage the installation of new DB2 releases

the production job will always refer to
DSN.DSNLOAD
the real dataset would be
DSN.V8R1M0.DSNLOAD
DSN.V9R1M0.DSNLOAD

DSN.DSNLOAD would point to DSN.V8R1M0.DSNLOAD

at cutover time to the new relase
a simple
Code:

 DEFINE ALIAS ( -
             NAME(DSN.DSNLOAD) -
             RELATE(DSN.V9R1M0.DSNLOAD) )


would implement the switch with no changes to ANY jcl
Back to top
View user's profile Send private message
Shobana

New User


Joined: 22 Mar 2005
Posts: 15
Location: Chennai

PostPosted: Thu Apr 05, 2007 10:08 am
Reply with quote

Hi,

Since the first step gets all the PDS with

[code]
1READY
LISTCAT ENT('BPAA.DBA.R010.CNTLCARD.*')
NONVSAM ------- BPAA.DBA.R010.CNTLCARD.V0702NT
IN-CAT --- SYS1.CRIS#.CATALOG
NONVSAM ------- BPAA.DBA.R010.CNTLCARD.V0704
IN-CAT --- SYS1.CRIS#.CATALOG
NONVSAM ------- BPAA.DBA.R010.CNTLCARD.V0706
IN-CAT --- SYS1.CRIS#.CATALOG
NONVSAM ------- BPAA.DBA.R010.CNTLCARD.V0708
IN-CAT --- SYS1.CRIS#.CATALOG
NONVSAM ------- BPAA.DBA.R010.CNTLCARD.V8TEST
IN-CAT --- SYS1.CRIS#.CATALOG
READY
END

In the above list i need BPAA.DBA.R010.CNTLCARD.V0708 in &THEPDS, but am getting BPAA.DBA.R010.CNTLCARD.V8TEST.
I tried listing the PDS as BPAA.DBA.R010.CNTLCARD.V0* but it's not working.

Is there any way i can get the list of PDS with BPAA.DBA.R010.CNTLCARD.V0*?

Regards,
Shobana
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Thu Apr 05, 2007 10:25 am
Reply with quote

Shobana,

Change the include condition of step2 to extract only records with 'NONVSAM' & 'BPAA.DBA.R010.CNTLCARD.V0'. I feel that should solve your problem.

Code:

INCLUDE=(6,7,CH,EQ,C'NONVSAM',AND,
                 22,25,CH,EQ,C'BPAA.DBA.R010.CNTLCARD.V0')
Back to top
View user's profile Send private message
Shobana

New User


Joined: 22 Mar 2005
Posts: 15
Location: Chennai

PostPosted: Thu Apr 05, 2007 10:49 am
Reply with quote

Nope icon_sad.gif

Its giving syntax error in the OUTFIL STATEMENT

Regards,
Shobana
Back to top
View user's profile Send private message
Shobana

New User


Joined: 22 Mar 2005
Posts: 15
Location: Chennai

PostPosted: Thu Apr 05, 2007 11:11 am
Reply with quote

Hi,

Found out the error. Now its working fine.

Thanks a lot icon_smile.gif

Regards,
Shobana
Back to top
View user's profile Send private message
Shobana

New User


Joined: 22 Mar 2005
Posts: 15
Location: Chennai

PostPosted: Wed May 16, 2007 12:04 pm
Reply with quote

Hi,

I have list of PDS, for example

BPAA.DBA.R010.CNTLCARD.V0704
BPAA.DBA.R010.CNTLCARD.V0706
BPAA.DBA.R010.CNTLCARD.V0706T0

By Using the above SORT card i can able to get the latest PDS. i.e BPAA.DBA.R010.CNTLCARD.V0706T0, but i need to get BPAA.DBA.R010.CNTLCARD.V0706 PDS as my output.

So i tried changing the code as follows

Code:


INCLUDE=(6,7,CH,EQ,C'NONVSAM',AND,45,2,CH,EQ,C'V0',
         AND,50,2,CH,EQ,C'  '),



but the above code is not working, am not getting anything in my output.
Do help me in this.

Thanks & Regards,
Shobana
Back to top
View user's profile Send private message
Devzee

Active Member


Joined: 20 Jan 2007
Posts: 684
Location: Hollywood

PostPosted: Wed May 16, 2007 6:05 pm
Reply with quote

Code:
AND,50,2,CH,EQ,C'  '),

The IDCAMS output is Variable length file and in position 50,2 it doesnt necesarlily be spaces. Thats the reason its not working.

You need to fix your SORT card.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Unable to interpret a hex value to De... COBOL Programming 4
No new posts how to eliminate null indicator value... DB2 7
No new posts Format Binary file to EBCDIC JCL & VSAM 4
No new posts Inserting into table while open selec... DB2 1
No new posts Binary File format getting change whi... All Other Mainframe Topics 7
Search our Forums:

Back to Top