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: Wed Nov 17, 2010 8:23 pm
Reply with quote

Hi,

I have the following req for which i need a help.

Please see the attachment for the details and advice.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Nov 17, 2010 8:27 pm
Reply with quote

do not post attachments, ( anyway there were no attachments )
not everybody can see them

paste as text and use the code tags like this ...
Code:
text formatted with the code tags

and before hitting the submit button use the preview button to check that everything is understandable
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Wed Nov 17, 2010 8:28 pm
Reply with quote

Errrrrr, had you provided the attachment I for one would not be able to open it, so post the input data and expected results using the code tags.

Also explain exactly what it is that you want to achieve.

Please run the code below to establish the sort product and release level installed in your site by posting the JES SYSOUT element.
Code:
//SORTSTEP EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTIN   DD *
ABC
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *
  SORT     FIELDS=COPY
Also provide details, LRECL & RECFM of the input and output files, the position, length and format of any key fields.

Also show what you have tried so far and the problems encountered.
Back to top
View user's profile Send private message
ksouren007

New User


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

PostPosted: Thu Nov 18, 2010 11:53 am
Reply with quote

I am sorry but donno why the screenshots are not getting pasted here..any way below are info in text fmt...please let me know if any other info is needed.

I am using syncsort.
Below is the LISTCAT history for a GDG file converted to a FB LRECL=120 file. I want to pick the latest GDG name which appears at the bottom.

Code:
Command ===>                                                  Scroll ===
=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+
000016       ATTRIBUTES                                                 
000017 0NONVSAM ------- TTA.TAI23.VRS.CESSDATA.G0024V00                 
000018       IN-CAT --- TICFCATC                                         
000019       HISTORY                                                     
000020         DATASET-OWNER-----(NULL)     CREATION--------2010.320     
000021         RELEASE----------------2     EXPIRATION------0000.000     
000022         ACCOUNT-INFO-----------------------------------(NULL)     
000023         STATUS------------ACTIVE                                 
000024       SMSDATA                                                     
000025         STORAGECLASS ------SCTST     MANAGEMENTCLASS----MCTST     
000026         DATACLASS ------STANDARD     LBACKUP ---2010.320.2015     
000027       VOLUMES                                                     
000028         VOLSER------------TEP243     DEVTYPE------X'3010200F'     
000029       ASSOCIATIONS                                               
000030         GDG------TTA.TAI23.VRS.CESSDATA                           
000031       ATTRIBUTES                                                 
000032 0NONVSAM ------- [b]TTA.TAI23.VRS.CESSDATA.G0025V00                 [/b]
000033       IN-CAT --- TICFCATC                                         
000034       HISTORY               

Using below sortcard for listing only the filenames in descending order.

Code:
=COLS> ----+----1----+----2----+----3----+----4----+----5----
 ****** ***************************** Top of Data ************
 000001  SORT FIELDS=(42,7,CH,D)                               
 000010  INCLUDE COND=(2,7,CH,EQ,C'NONVSAM',AND,18,24,CH,EQ,   
 000020                          C'TTA.TAI23.VRS.CESSDATA.G')
 ****** **************************** Bottom of Data **********   



Which is giving the following op...FB LRECL=120

Code:
Command ===>                                     
----+----1----+----2----+----3----+----4----+----5
********************************* Top of Data ****
0NONVSAM ------- TTA.TAI23.VRS.CESSDATA.G0028V00   
0NONVSAM ------- TTA.TAI23.VRS.CESSDATA.G0027V00   
0NONVSAM ------- TTA.TAI23.VRS.CESSDATA.G0026V00   
0NONVSAM ------- TTA.TAI23.VRS.CESSDATA.G0025V00   
0NONVSAM ------- TTA.TAI23.VRS.CESSDATA.G0024V00   
******************************** Bottom of Data **


Now i want to avoid another sort step to pick up the topmost record if any other options can be added to my above sortcard which will give me only the topmost file name in the above file instead of the listing.

Thanks a ton in adv.
Back to top
View user's profile Send private message
ksouren007

New User


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

PostPosted: Thu Nov 18, 2010 11:59 am
Reply with quote

Code:
********************************* TOP OF DATA **********************************
 SYNCSORT FOR Z/OS  1.3.2.0R 
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Thu Nov 18, 2010 12:06 pm
Reply with quote

You were given a kind advice on how to post, but You just did not care
Your post was edited to show You the right way of posting screen info


what is that You did not understand in my first answer ???
looks like You only got training in writing but not in reading icon_evil.gif

also Your other post was again edited to make things more readable
the code tags force the browser to use a fixed pitch font,
screen shots, file layouts, sysouts are easier to understand

also You should get training on how not to post employer' related info
just posting the syncsort level would have been enough
Your post was edited to get rid of confidential info
Back to top
View user's profile Send private message
ksouren007

New User


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

PostPosted: Thu Nov 18, 2010 12:55 pm
Reply with quote

Thanks for the Shouting Enrico...MY bad...I got it now...!
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Thu Nov 18, 2010 1:44 pm
Reply with quote

once in a while a little shouting helps.. doent' it icon_biggrin.gif icon_biggrin.gif
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Thu Nov 18, 2010 2:05 pm
Reply with quote

How about adding this to your sort card to write the filename into a dataset of FB/LRECL=44
Code:
 OUTFIL ENDREC=1,BUILD=(18,44)
Back to top
View user's profile Send private message
ksouren007

New User


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

PostPosted: Thu Nov 18, 2010 6:30 pm
Reply with quote

Thanks a lot Arun!!!! It worked great...Now i have another task which is as below...i think it can be done using inrec/outrec function but not being able to get the desired op. If possible could anybody pls help me once again...

I have the first file as below: FB/115 with first 44 bytes empty.

Code:
=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
 ****** ***************************** Top of Data ******************************
 000001                               |+000005500000|+000000016527.50|0000000000
 000002                               |+000003575000|+000000007859.92|0000000000
 ****** **************************** Bottom of Data ****************************


And the second file which i got using Arun's code: FB/44

Code:
=COLS> ----+----1----+----2----+----3----+----4----
 ****** ***************************** Top of Data ***
 000001 TTA.TAI23.VRS.CESSDATA.G0028V00               
 000002 TTA.TAI23.VRS.POLMSTR.G0016V00               
  ****** **************************** Bottom of Data *


These two files will always have two records only.

And the op file will be a concatenated one like below: FB/115..LRECLs are now now a bit jeoperdised now but i will adjust them later...

Code:
  =COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
 ****** ***************************** Top of Data ******************************
 000001 TTA.TAI23.VRS.CESSDATA.G0028V00  |+000005500000|+000000016527.50|0000000000
 000002  TA.TAI23.VRS.POLMSTR.G0016V00       |+000003575000|+000000007859.92|0000000000
 ****** **************************** Bottom of Data ****************************


Any sort card clue for this please?

@Enrico: How's the post this time??? icon_smile.gif
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Thu Nov 18, 2010 7:04 pm
Reply with quote

looks good to me,
the aesthetics at least, for the content You will have to wait for the next episode icon_biggrin.gif
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Thu Nov 18, 2010 9:13 pm
Reply with quote

How are you generating the file-1 (LRECL 115)? How is it related to the data in file-2?

Will both the files always have same number of records? If not, show an example showing all possible input combinations(file-1 rec count > or < file-2 rec count) and expected output out of it.
Back to top
View user's profile Send private message
ksouren007

New User


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

PostPosted: Thu Nov 18, 2010 11:00 pm
Reply with quote

Hi Arun,

the file one is a kind of control file containing some total record counts of 2 data op files whose gdg version names will be the first fields of the merged op files.

like in the last screen shot...the first record shows control totals of cessdata file and the second record shows the ctrl record of the polmstr file.
It will be like this everytime just the gdg version names and their corresponding control total values will be different after each run.

I would just have to concatenate these two files every time...Hope this explains.
Back to top
View user's profile Send private message
ksouren007

New User


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

PostPosted: Thu Nov 18, 2010 11:05 pm
Reply with quote

I could not get all the required data for my control file from the program (the gdg generation corrected from version names) that y kept the first field empty. Then by idcams listcat i got their names in a different file which now I want to populate in the empty fields of my control file...no other manipulation or combination just simple concatenation.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Fri Nov 19, 2010 5:05 pm
Reply with quote

Is not this a similar topic: www.ibmmainframes.com/viewtopic.php?t=52170&highlight=
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Fri Nov 19, 2010 6:42 pm
Reply with quote

Anuj,

It's exactly the same question raised by the OP. Trying multiple options. icon_biggrin.gif
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Fri Nov 19, 2010 6:56 pm
Reply with quote

Quote:
the file one is a kind of control file containing some total record counts of 2 data op files whose gdg version names will be the first fields of the merged op files
ksouren007,

I was asking how or which process generates/writes this control file?

Oops. Sorry Anuj. I just noticed I mispelled your name.
Back to top
View user's profile Send private message
ksouren007

New User


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

PostPosted: Fri Nov 19, 2010 9:02 pm
Reply with quote

Exactly...But I want to know about both the ways...Learning doesn't cause any harm i guess icon_smile.gif
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Fri Nov 19, 2010 11:47 pm
Reply with quote

Quote:
But I want to know about both the ways
But you dont seem to be willing to help yourself - by not answering the questions asked.
Back to top
View user's profile Send private message
ksouren007

New User


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

PostPosted: Sat Nov 20, 2010 12:25 pm
Reply with quote

1. I have a COBOL program which generates two data files and one control file.

2. the jobstep which runs the program has 3 above o/p files.

3. In the control file whosee structure is is given already LRECL 115 FB has to hold only two records always. The first field of this file will contain the respective GDG file names of the data files generated in that step itself. The other fileds are bing populated through the program. Only the fisrt field has been left blank.

4. In the next steps i take the recent generation of the data files and run IDCAMS listcat and other sort procecesses to get their gdg version names in a diffrent file. LRECL 44 FB.

5. now i just want to fill up the blanks in the original control file with their respective file names.

rest is given as screenshots above. Hope this explains the total process.
Back to top
View user's profile Send private 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
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