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 

how to select the latest PS file
Goto page 1, 2  Next
 
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
shyamsaravan
Beginner


Joined: 12 May 2010
Posts: 44
Topics: 12
Location: India

PostPosted: Thu Jul 01, 2010 9:18 am    Post subject: how to select the latest PS file Reply with quote

Hi;

i have a requirement on how to get latest generated PS file in the PDS.

My PS file looks like
'aaaa.bbbb.cccc.v0001'
.
..
'aaaa.bbbb.cccc.v0007'
.

'aaaa.bbbb.cccc.v0009'

So the JCL has to select the latest generated PS file( ie..compare the last qualifier of the PS file,which is higher that would be a latest(for this case v0009)).

Please write a JCL for the above requirement. Question
Please help on this...
Back to top
View user's profile Send private message
CraigG
Intermediate


Joined: 02 May 2007
Posts: 202
Topics: 0
Location: Viginia, USA

PostPosted: Thu Jul 01, 2010 9:59 am    Post subject: Reply with quote

That is why there GDG's!
Back to top
View user's profile Send private message
shyamsaravan
Beginner


Joined: 12 May 2010
Posts: 44
Topics: 12
Location: India

PostPosted: Fri Jul 02, 2010 2:49 am    Post subject: Reply with quote

Hi;

I agree the GDG concept,but i need the solution of the above requirement,because we have to send the PS file to different server thru Mailbox.They has the system to receive the PS file in the FTP format only, not a GDG file.

So i need a JCL to find the latest generated Flat file.

Thanks in advance
Back to top
View user's profile Send private message
Anuj Dhawan
Intermediate


Joined: 19 Jul 2007
Posts: 298
Topics: 7
Location: Mumbai,India

PostPosted: Fri Jul 02, 2010 3:34 am    Post subject: Reply with quote

It should be doable - for a hint, look at the smart DFSORT trick "Copy GDGs created today" which reads in the LISTCAT info and generates dynamic JCL to be submitted via INTRDR

http://www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000094
_________________
Regards,
Anuj
Back to top
View user's profile Send private message
arvibala
Beginner


Joined: 12 Feb 2008
Posts: 142
Topics: 67

PostPosted: Fri Jul 02, 2010 7:01 am    Post subject: Reply with quote

Shyam,

Help me understand. For ur question I think you have a GDG base "'aaaa.bbbb.cccc" and there are diff versions created. You want to send the latest version through FTP ... correct.

Why dont u send "'aaaa.bbbb.cccc(0)". All individual versions of a GDG are PS files.
_________________
Arvind
"You can make a difference with your smile. Have that with you always"
Back to top
View user's profile Send private message Yahoo Messenger
CraigG
Intermediate


Joined: 02 May 2007
Posts: 202
Topics: 0
Location: Viginia, USA

PostPosted: Fri Jul 02, 2010 7:26 am    Post subject: Reply with quote

arvibala wrote:
Shyam,

Help me understand. For ur question I think you have a GDG base "'aaaa.bbbb.cccc" and there are diff versions created. You want to send the latest version through FTP ... correct.

Why dont u send "'aaaa.bbbb.cccc(0)". All individual versions of a GDG are PS files.


Versions and Generations are both terms that apply to GDG's but they have very different meanings!
Back to top
View user's profile Send private message
shyamsaravan
Beginner


Joined: 12 May 2010
Posts: 44
Topics: 12
Location: India

PostPosted: Fri Jul 02, 2010 9:57 am    Post subject: Reply with quote

Hi;

Our mailbox is sending the PS files by daily basis,The last qualifier only will increment.So my JCL has to select the highest value of last qualifier dataset.

For eg:

xxx.test.n0001
xxx.test.n0002
xxx.test.n0003
so JCL need to select the xxx.test.n0003 only .

thanks all;
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Fri Jul 02, 2010 10:17 am    Post subject: Reply with quote

shyamsaravan,

What do you need to do after you SELECT the latest file? Do you need to copy or process thru another program? It is very to easy to get the latest file. You can simply sort on the 44 bytes ( the max for DS name) and pick only the first record.
Code:

//STEP0100 EXEC PGM=SORT         
//SYSOUT   DD SYSOUT=*           
//SORTIN   DD *                 
XXX.TEST.N0001                   
XXX.TEST.N0002                   
XXX.TEST.N0003                   
//SORTOUT  DD SYSOUT=*           
//SYSIN    DD *                 
  SORT FIELDS=(1,44,CH,D)       
  OUTFIL ENDREC=1               
//*


The output from this is

Code:

XXX.TEST.N0003   

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
shyamsaravan
Beginner


Joined: 12 May 2010
Posts: 44
Topics: 12
Location: India

PostPosted: Tue Jul 06, 2010 9:06 am    Post subject: Reply with quote

Thanks,our internal JCL generates the Flat file daily with the incremental of the last qualifier,so i need to get the latest file and has to copy to the another flat file.

So, i cant give the Flat files in the SORTIN card manualy.My JCL needs to pick the latest file(LRECL=88,FB) and copy to the another Flat file as the same record format when run the new JCL.

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


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Tue Jul 06, 2010 9:20 am    Post subject: Reply with quote

another reason for gdg's.
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Tue Jul 06, 2010 10:22 am    Post subject: Reply with quote

shyamsaravan wrote:
Thanks,our internal JCL generates the Flat file daily with the incremental of the last qualifier,so i need to get the latest file and has to copy to the another flat file.

So, i cant give the Flat files in the SORTIN card manualy.My JCL needs to pick the latest file(LRECL=88,FB) and copy to the another Flat file as the same record format when run the new JCL.

Thanks for all


shyamsaravan,

bonk I just showed you an example of instream data , you can change it to your file name.

change //SORTIN DD * to
Code:

//SORTIN   DD DISP=SHR,DSN=Your input 88 byte file


and get rid off instream data
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
expat
Intermediate


Joined: 01 Mar 2007
Posts: 475
Topics: 9
Location: Welsh Wales

PostPosted: Wed Jul 07, 2010 2:04 am    Post subject: Reply with quote

shyamsaravan wrote:
i have a requirement on how to get latest generated PS file in the PDS.
Can you please explain what a PS in PDS is. Would you perhaps mean MEMBER

Unfortunately, methinks that the OP is treating the symptoms rather than the cause of the problem.

In a well planned and implemented application this scenario should not occur.

Job A creates dataset A1.
Dataset A1 is used as an event trigger to submit FTP / whatever job - using scheduler date variables if required to make the target dataset unique.
Dataset A1 remains until the next run where it is deleted and recreated, and hey presto triggers the FTP / whatever job again.

Absolutely no need for additional processing (aka resource waste) to do what a thought out application should have done in the first place.
_________________
If it's true that we are here to help others,
then what exactly are the others here for ?
Back to top
View user's profile Send private message
shyamsaravan
Beginner


Joined: 12 May 2010
Posts: 44
Topics: 12
Location: India

PostPosted: Wed Jul 07, 2010 10:22 am    Post subject: Reply with quote

Thanks kolusu, I understood what you said earlier.

my DSLIST has
Code:

xxx.test.n0001
xxx.test.n0002
xxx.test.n0003
xxx.test.n0004


my jcl

Code:

//aaaaa JOB (reefm,fgrrr),'samp',CLASS=T,MSGCLASS=Z,
//             REGION=4096K,NOTIFY=&SYSUID               
//STEP0100 EXEC PGM=SORT                                 
//SYSOUT   DD SYSOUT=*                                   
//SORTIN   DD DISP=SHR,DSN=xxx.test1             
//SORTOUT  DD SYSOUT=*                                   
//SYSIN    DD *                                           
  SORT FIELDS=(1,44,CH,D)                                 
  OUTFIL ENDREC=1                                         
//*                                   



output is displayed last record only,

but my requirement is my jcl need to copy the records of the latest generated Flat file(ie xxx.test.n0004) to another Flat file,because for every generated Flat file has different datas,,i need latest datas to be copied to the another file

Thanks;
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Wed Jul 07, 2010 10:49 am    Post subject: Reply with quote

shyamsaravan,

Use the following DFSORT JCL and it will create a Dynamic JCL which you can submit it via INTRDR


Code:

//STEP0100 EXEC PGM=SORT         
//SYSOUT   DD SYSOUT=*           
//SORTIN   DD DSN=Your input ps list file,DISP=SHR
//SORTOUT  DD SYSOUT=*                                         
//SYSIN    DD *                                                 
  SORT FIELDS=(1,44,CH,D)                                       
  OUTFIL ENDREC=1,                                             
  BUILD=(C'//TIDXXXXA JOB ''',C'COPY''',C',',/,                 
         C'//             CLASS=A,',/,                         
         C'//             MSGCLASS=Y,',/,                       
         C'//             MSGLEVEL=(1,1),',/,                   
         C'//             NOTIFY=TID',/,                       
         C'//*',/,                                             
         C'//STEP0100 EXEC  PGM=SORT',/,                       
         C'//SYSOUT   DD SYSOUT=*',/,                           
         C'//SORTIN   DD DISP=SHR,DSN=',1,44,/,                 
         C'//SORTOUT  DD DSN=YOUR NEW COPY OF LATEST FILE,',/, 
         C'//            DISP=(NEW,CATLG,DELETE),',/,           
         C'//            UNIT=SYSDA,',/,                       
         C'//            SPACE=(CYL,(X,Y),RLSE)',/,             
         C'//SYSIN    DD *',/,                                 
         C'  SORT FIELDS=COPY',/,                               
         C'//*',80:X)                                           
//*


Once you verify that JCL generated is right , Change the following line
Code:

//SORTOUT  DD SYSOUT=* 

to
Code:

//SORTOUT  DD SYSOUT=(*,INTRDR)

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
shyamsaravan
Beginner


Joined: 12 May 2010
Posts: 44
Topics: 12
Location: India

PostPosted: Thu Jul 08, 2010 10:09 am    Post subject: Reply with quote

MY JCL LIKE AS
Code:

//OAZA7PS JOB (W100Q82S,WES-00),'SAMP',CLASS=T,MSGCLASS=Z,     
//             REGION=4096K,NOTIFY=&SYSUID                     
//STEP0100 EXEC PGM=SORT                                       
//SYSOUT   DD SYSOUT=*                                         
//SORTIN   DD DSN=OAZAE34.AS.BOX.N0001,DISP=SHR           
//SORTOUT  DD SYSOUT=(*,INTRDR)                               
//SYSIN    DD *                                               
        SORT FIELDS=(1,44,CH,D)                               
         OUTFIL ENDREC=1,                                     
         BUILD=(C'//OAZA7PS JOB W100Q82S,''',C'COPY''',C',',/,
            C'//             CLASS=T,',/,                     
            C'//             MSGCLASS=Z,',/,                   
            C'//             MSGLEVEL=(1,1),',/,               
            C'//             NOTIFY=OAZAE34',/,                 
            C'//*',/,                                         
            C'//STEP0100 EXEC  PGM=SORT',/,                   
            C'//SYSOUT   DD SYSOUT=*',/,                       
            C'//SORTIN   DD DISP=SHR,DSN=',1,44,/,             
            C'//SORTOUT  DD DSN=OAZAE34.TEST.COPYOUT,',/,     
            C'//            DISP=(NEW,CATLG,DELETE),',/,       
            C'//            UNIT=SYSDA,',/,                   
            C'//            SPACE=(CYL,(1,1),RLSE)',/,         
            C'//SYSIN    DD *',/,                             
                     C'  SORT FIELDS=COPY',/,                 
                     C'//*',80:X)             
//*             


MY DSLIST HAS

Code:

OAZAE34.TEST.DATA       
OAZAE34.SAMP.TEST.JOBS       
OAZAE34.RAS.TEST.SAMPLE.JOBS
OAZAE34.COBOL.DATA       
OAZAE34.TIMS.SLIB           
OAZAE34.AS.BOX.N0001
OAZAE34.AS.BOX.N0002   
OAZAE34.AS.BOX.N0003
OAZAE34.AS.BOX.N0004
OAZAE34.EQQ1.SPFTEMP3.CNTL
OAZAE34.SUPERC.LIST       
OAZAE34.TSOPROF   


From the above list JCL has to copy the all records which are resided at the file
OAZAE34.AS.BOX.N0004(which is latest in the list now).
This file is generated N number of times with the incremental of last qualifier


my JOB HAS ABENED
Code:

 STMT NO. MESSAGE                                                 
-                                                                 
        4 IEF642I EXCESSIVE PARAMETER LENGTH IN THE DSNAME FIELD   


because SORTIN card takes a Last record in the file OAZAE34.AS.BOX.N0001 and treated as a DSN in the next SORTIN.

Thanks all;
Back to top
View user's profile Send private message
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
Goto page 1, 2  Next
Page 1 of 2

 
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