Select the latest generated file



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

Select the latest generated file

Postby shyamsaravan » Tue Jul 13, 2010 1:09 pm

Hi;
The below JCL generates the GDG version and it will be the input of STEP02 jcl ,It is our internal JCL which has to send the output file to the different region with help of mailbox(ADCDEF11 : mailbox name).The producing output file will be a Flatfile(RECFM-FB,LRECL-88) with incremantal of last qulafier.
//step01   EXEC  PGM=SORT                                   
//SYSOUT    DD  SYSOUT=*                                     
//SORTIN   DD DSN=ti.te.test1.current(0),                 
//          DISP=SHR                                         
//SORTOUT  DD DSN=hi.lo.test1.out(+1),UNIT=sysda,     
//          DISP=(NEW,CATLG,DELETE),SPACE=(TRK,(15,15),RLSE),
//          DCB=(RECFM=FB,LRECL=88,BLKSIZE=0)     
//*                                                         
//SYSIN    DD    *

   INCLUDE COND=(11,7,CH,EQ,C'accesso')
   sort fields=copy

//*                                                               
//*  COPY OUTPUT TO mailNET FILE(MAILBOX: ABCDEF11)         
//*
//step02   EXEC PGM=SENDPGM,PARM='ABCDEF11'                       
//SYSPRINT DD SYSOUT=*                                           
//INFILE   DD DSN=hi.lo.test1.out(+1),DISP=(OLD,KEEP)       
//*                                                                                               


The output file seems like that..keep going the incremental of last qualifier

FLAT.TEST.ABCDEF11.N0005
FLAT.TEST.ABCDEF11.N0006
FLAT.TEST.ABCDEF11.N0007
FLAT.TEST.ABCDEF11.N0008
FLAT.TEST.ABCDEF11.N0009

My question is how to copy the records to another outputfile from the latest version of the mailbox produced flatfile.
The New JCL has to pick the latest generated file directly and to copy the output file(for this case,input is : FLAT.TEST.ABCDEF11.N0009);
So JCL has to compare the all mailbox filename(Not a records) with each other,then only we come to know the latest file.

Thanks;
shyamsaravan
 
Posts: 40
Joined: Tue May 11, 2010 7:56 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Select the latest generated file

Postby dick scherrer » Tue Jul 13, 2010 11:17 pm

Hello,

Your process does not use versons - it uses generations. While either might be valid - there is quite a difference between them.

So JCL has to compare the all mailbox filename(Not a records) with each other
JCL cannot do this - all jcl can do is execute programs. . .

Why does someone believe this naming is a good thing to do? Why not simply use a different gdg name and create a +1?
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Select the latest generated file

Postby NicC » Wed Jul 14, 2010 1:46 am

You were given solutions to this in another forum. You were also told there about versions and generations.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: Select the latest generated file

Postby shyamsaravan » Wed Jul 14, 2010 3:09 pm

Why not simply use a different gdg name and create a +1?


step02 EXEC PGM=SENDPGM,PARM='ABCDEF11'


Our inbuilt internal program will not generate GDG,It will generate flat file only with incremental of last qualifier
shyamsaravan
 
Posts: 40
Joined: Tue May 11, 2010 7:56 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Select the latest generated file

Postby Robert Sample » Wed Jul 14, 2010 4:41 pm

You'll need at least two steps to do this. The first step will execute IDCAMS to do a LISTCAT on the high level qualifier; the output goes to a data set that is used as input to a program which analyzes the IDCAMS output to determine the last data set. If this data set name must be used in JCL, the program can then submit via the internal reader a second job that accesses the data set. Otherwise, the program can use BPXWDYN to dynamically allocate the data set and proceed to complete the process.

If the data set must be in JCL, you absolutely cannot do this in a single job. JCL is fixed once it goes through the converter / interpreter of JES, so dynamic changes to JCL while it is running are not allowed.
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: Select the latest generated file

Postby shyamsaravan » Wed Jul 14, 2010 6:05 pm

I ran the below JCL using IDCAMS with a LISTCAT on high level qualifier,but it was not shown all datasets information.

If i give a GDG Base in the LISTCAT means,it will give all generation versions info...but not in PS

The first step will execute IDCAMS to do a LISTCAT on the high level qualifier


//jobcard
//STEP01 EXEC PGM=IDCAMS                           
//SYSOUT DD SYSOUT=*                               
//SYSPRINT DD SYSOUT=*                             
//SYSIN DD *
   LISTCAT ENT('FLAT') ALL
/*                                       


My sysout seems below
IDCAMS  SYSTEM SERVICES                                           TIME: 14:05:57
                                                                               
       LISTCAT ENT('FLAT') ALL                                            00110001
ALIAS --------- NE                                                             
     IN-CAT --- SYS2.SYU2.MSTRCTLG                                             
     HISTORY                                                                   
       RELEASE----------------2                                                 
     ASSOCIATIONS                                                               
       USERCAT--CAT.PROD                                                       
IDCAMS  SYSTEM SERVICES                                           TIME: 14:05:57
         THE NUMBER OF ENTRIES PROCESSED WAS:                                   
                   AIX -------------------0                                     
                   ALIAS -----------------1                                     
                   CLUSTER ---------------0                                     
                   DATA ------------------0                                     
                   GDG -------------------0                                     
                   INDEX -----------------0                                     
                   NONVSAM ---------------0                                     
                   PAGESPACE -------------0                                     
                   PATH ------------------0                                     
                   SPACE -----------------0                                     
                   USERCATALOG -----------0                                     
                   TAPELIBRARY -----------0                                     
                   TAPEVOLUME ------------0                                     
                   TAPEVOLUME ------------0                       
                   TOTAL -----------------1                       
         THE NUMBER OF PROTECTED ENTRIES SUPPRESSED WAS 0         
IDC0001I FUNCTION COMPLETED, HIGHEST CONDITION CODE WAS 0         
                                                                   
IDC0002I IDCAMS PROCESSING COMPLETE. MAXIMUM CONDITION CODE WAS 0 


Just i tried my way,Please give me the code what you suggested earlier
shyamsaravan
 
Posts: 40
Joined: Tue May 11, 2010 7:56 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Select the latest generated file

Postby Robert Sample » Wed Jul 14, 2010 6:20 pm

LISTCAT LVL(FLAT) ALL
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: Select the latest generated file

Postby shyamsaravan » Wed Jul 14, 2010 7:58 pm

Thanks Robert...it is working fine :mrgreen:
shyamsaravan
 
Posts: 40
Joined: Tue May 11, 2010 7:56 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Select the latest generated file

Postby Robert Sample » Wed Jul 14, 2010 10:08 pm

Glad to hear it.
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times


Return to JCL

 


  • Related topics
    Replies
    Views
    Last post