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

Need single sort card to sort and pick the topmost rec


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

New User


Joined: 30 Jun 2010
Posts: 85
Location: Toronto, ON

PostPosted: Fri Dec 03, 2010 5:38 pm
Reply with quote

Got that after going through a series of manuals on IDCAMS...

The below code will directly get the Latest version of the GDG files and eliminate the other details.

No need for another sort step to get the Latest version of the GDG name.

May be evryone knows this except me still in case somebody faces the same requirement in future this might help!!
Thanks all for your help.

Code:
000004 //GDGNAME EXEC PGM=IDCAMS,COND=(0,NE)                         
000005 //***********************************************************
000006 //*                                                           
000007 //*STEPLIB   DD DISP=SHR,DSN=ETA.T.S1MAIN.LOAD               
000008 //*                                                           
000009 //***********************************************************
000010 //DD1       DD DISP=SHR,DSN=TTA.TAI23.VRS.POLMSTR.SORT(0)     
000011 //DD2       DD DISP=SHR,DSN=TTA.TAI23.VRS.CESSDATA.SORT(0)   
000012 //SYSTSPRT  DD SYSOUT=*                                       
000013 //SYSPRINT  DD DSN=TTA.TAI23.GDGNAME.SYSPRINT,               
000014 //             DISP=(,CATLG,DELETE),                         
000015 //             SPACE=(TRK,(35,45),RLSE),UNIT=TEST             
000016 //*            DCB=(DSORG=PS,RECFM=FB,LRECL=80,BLKSIZE=0)     
000017 //SYSOUT    DD SYSOUT=*                                       
000018 //AMSDUMP   DD SYSOUT=*                                       
000019 //SYSIN     DD *                                             
000020  PRINT INFILE(DD1) COUNT(0) CHAR                             
000021  PRINT INFILE(DD2) COUNT(0) CHAR                             



You get the following output which are the latest versions of the GDG files.

Code:
000001 1IDCAMS  SYSTEM SERVICES                                     
000002 0                                                           
000003   PRINT INFILE(DD1) COUNT(0) CHAR                           
000004 1IDCAMS  SYSTEM SERVICES                                     
000005 -LISTING OF DATA SET -TTA.TAI23.VRS.POLMSTR.SORT.G0008V00   
000006 0IDC0005I NUMBER OF RECORDS PROCESSED WAS 0                 
000007 0IDC0001I FUNCTION COMPLETED, HIGHEST CONDITION CODE WAS 0   
000008 1IDCAMS  SYSTEM SERVICES                                     
000009 0                                                           
000010   PRINT INFILE(DD2) COUNT(0) CHAR                           
000011 1IDCAMS  SYSTEM SERVICES                                     
000012 -LISTING OF DATA SET -TTA.TAI23.VRS.CESSDATA.SORT.G0008V00   
000013 0IDC0005I NUMBER OF RECORDS PROCESSED WAS 0                 
000014 0IDC0001I FUNCTION COMPLETED, HIGHEST CONDITION CODE WAS 0   
000015 1IDCAMS  SYSTEM SERVICES                                     
000016 0                                                           
000017 0IDC0002I IDCAMS PROCESSING COMPLETE. MAXIMUM CONDITION CODE
****** **************************** Bottom of Data ****************
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Dec 03, 2010 8:47 pm
Reply with quote

Hello,

Once again version has been misused. . .

Keep in mind - "We don' need no steenkin' version" . . .

What this shows is the latest generation.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Tue Dec 07, 2010 12:19 pm
Reply with quote

Quote:
No need for another sort step to get the Latest version of the GDG name.
But I dont think it has given an advantage of "saving a step". As per your requirement, you need to extract the latest generation filename and fix it onto the data contained in another file.
Back to top
View user's profile Send private message
ksouren007

New User


Joined: 30 Jun 2010
Posts: 85
Location: Toronto, ON

PostPosted: Tue Dec 07, 2010 12:32 pm
Reply with quote

dick,

My bad icon_sad.gif Used the more Colloquial and compact term to describe what i wanted to express!!

Below should apply for my above post.

Code:
C ALL 'VERSION' 'GENERATION'


Arun,

This saved my intermediate sort step where i was sorting my listcat output on descending order based on the generation number as listcat output was coming in ascending order, i mean the oldest generation first.

Now as i am getting the latest generation right away i can vertically merge both the files in the next step itself. So saved one sortcard.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Tue Dec 07, 2010 12:47 pm
Reply with quote

Souren,

Can you show, how your final JCL looks like along with the control cards.
Back to top
View user's profile Send private message
ksouren007

New User


Joined: 30 Jun 2010
Posts: 85
Location: Toronto, ON

PostPosted: Tue Dec 07, 2010 1:04 pm
Reply with quote

Sure Arun...!!

1. Listcat for two ip files with only the latest generation details.

Code:
//*********************************************************************
//*                                                                   *
//* GET THE LATEST GDG FILE NAMES FOR THE OUTPUT DATA FILES           *
//*                                                                   *
//*********************************************************************
//*                                                                     
//LISTCAT EXEC PGM=IDCAMS,COND=(0,NE)                                   
//DD1       DD DISP=SHR,DSN=TTA.TAI23.VRS.POLMSTR(+1)                   
//DD2       DD DISP=SHR,DSN=TTA.TAI23.VRS.CESSDATA(+1)                 
//SYSTSPRT  DD SYSOUT=*                                                 
//SYSPRINT  DD DISP=(NEW,PASS),DSN=&&LISTGDG,                           
//             SPACE=(TRK,(35,45),RLSE),UNIT=SYSWK                     
//SYSOUT    DD SYSOUT=*                                                 
//AMSDUMP   DD SYSOUT=*                                                 
//SYSIN     DD DISP=SHR,DSN=TTA.RAIPUMO.VRS.CTLCARD(TAIVLST1)           
//*                                                                     



2. The sortcard

Code:

***************************** Top of Data **
 PRINT INFILE(DD1) COUNT(0) CHAR             
 PRINT INFILE(DD2) COUNT(0) CHAR             
**************************** Bottom of Data


3. Vertical Merge

Code:
000184 //*********************************************************************
000185 //*                                                                   *
000186 //* MERGE THE LATEST GDG FILE NAMES WITH THE CONTROL FILE             *
000187 //*                                                                   *
000188 //*********************************************************************
000189 //*                                                                     
000190 //SORT07  EXEC PGM=SORT,COND=(0,NE),                                   
000191 //             PARM='CORE=MAX'                                         
000192 //SYSOUT    DD SYSOUT=*                                                 
000193 //SORTLIB   DD DISP=SHR,DSN=SYS1.SUBLIB                                 
000194 //SORTJNF1  DD DISP=(OLD,DELETE),DSN=&&LISTGDG                         
000195 //SORTJNF2  DD DISP=SHR,DSN=TTA.TAI23.VRS.TEMPCTRL(+1)                 
000196 //SORTOUT   DD DISP=(,CATLG,),DSN=TTA.TAI23.VRS.CTRL(+1),               
000197 //             SPACE=(TRK,(10,10),RLSE),                               
000198 //             DCB=(PTS.MODEL,RECFM=FB,LRECL=109),STORCLAS=SCTST,       
000199 //             MGMTCLAS=MCTST                                           
000200 //SYSIN     DD DISP=SHR,DSN=TTA.RAIPUMO.VRS.CTLCARD(TAIVLST2)           
000201 //*             


4. The sortcard

Code:
***************************** Top of Data **
 JOINKEYS FILES=F1,FIELDS=(41,4,D)           
 JOINKEYS FILES=F2,FIELDS=(1,4,D)           
 REFORMAT FIELDS=(F1:27,44,F2:45,65)         
 SORT FIELDS=COPY                           
**************************** Bottom of Data


5. JNF2

Code:
 ****** ***************************** Top of Data ******************************
 000001 POLM              |+00307799272148|+0000303578
 000002 CESS              |+00241172258705|+0000087257
 ****** **************************** Bottom of Data ****************************




6. Sortout (Final File)

Code:
 ****** ***************************** Top of Data ******************************
 000001 TTA.TAI23.VRS.POLMSTR.G0004V00              |+00307799272148|+0000303578
 000002 TTA.TAI23.VRS.CESSDATA.G0004V00             |+00241172258705|+0000087257
 ****** **************************** Bottom of Data ****************************
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Tue Dec 07, 2010 5:37 pm
Reply with quote

Thanks for posting. I see that you have modified your program to introduce a 4 byte "key" in the output file to simulate a match for each filename.
Back to top
View user's profile Send private message
ksouren007

New User


Joined: 30 Jun 2010
Posts: 85
Location: Toronto, ON

PostPosted: Tue Dec 07, 2010 5:56 pm
Reply with quote

Couldn't find a much better option icon_smile.gif ...except Rexx which I dont know icon_sad.gif
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 Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
Search our Forums:

Back to Top