View previous topic :: View next topic
|
Author |
Message |
Sachin Sukumaran
New User
Joined: 31 Jul 2012 Posts: 3 Location: India
|
|
|
|
I have a log file of 8.5 GB. I FTPed it to mainframe. I don't know the exact count of records of the file . I need to get the last 15000 records from that file.
I am expecting to get a JCL for this .
(Why I need this : I have a job hung , so only after getting the last records , I can debug this )
Thanks in advance |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Whats the sort product you have? |
|
Back to top |
|
|
Gary McDowell
Active User
Joined: 15 Oct 2012 Posts: 139 Location: USA
|
|
|
|
I guess you could use something to count number of records on file first, then extract the last 15000 records - something like this...
Code: |
//*-- COUNT NUMBER OF RECORDS ON FILE WITHOUT DETAIL SHOWING
//STEP010 EXEC PGM=SORT
//SYSOUD DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SORTIN DD DSN=INPUT.FILE.HERE,DISP=SHR
//SORTOUT DD DSN=OUTPUT.FILE.HERE,
// DISP=(NEW,CATLG,DELETE),
// SPACE=(TRK,(1,1),RLSE),
// UNIT=SYSDA,
// DCB=(LRECL=???,RECFM=FB,BLKSIZE=0)
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL NODETAIL,TRAILER1=(1/,5:'COUNT=',COUNT)
/*
//*
//*
//*-- EXTRACT NUMBER OF RECORDS USING SKIP AND COUNT
//STEP020 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSOUD DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//FILEA DD DSN=INPUT.FILE.HERE,DISP=SHR
//FILEB DD DSN=OUTPUT.FILE.HERE,
// DISP=(NEW,CATLG,DELETE),
// SPACE=(TRK,(120,60),RLSE),
// UNIT=SYSDA,
// DCB=(LRECL=???,RECFM=FB,BLKSIZE=0)
//*
//SYSIN DD *
REPRO -
INFILE(FILEA) -
SKIP(?????) COUNT(15000) -
OUTFILE(FILEB)
/*
// |
|
|
Back to top |
|
|
Sachin Sukumaran
New User
Joined: 31 Jul 2012 Posts: 3 Location: India
|
|
|
|
Pandora-Box wrote: |
Whats the sort product you have? |
SYNCSORT |
|
Back to top |
|
|
Sachin Sukumaran
New User
Joined: 31 Jul 2012 Posts: 3 Location: India
|
|
|
|
Gary McDowell wrote: |
I guess you could use something to count number of records on file first, then extract the last 15000 records - something like this...
Code: |
//*-- COUNT NUMBER OF RECORDS ON FILE WITHOUT DETAIL SHOWING
//STEP010 EXEC PGM=SORT
//SYSOUD DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SORTIN DD DSN=INPUT.FILE.HERE,DISP=SHR
//SORTOUT DD DSN=OUTPUT.FILE.HERE,
// DISP=(NEW,CATLG,DELETE),
// SPACE=(TRK,(1,1),RLSE),
// UNIT=SYSDA,
// DCB=(LRECL=???,RECFM=FB,BLKSIZE=0)
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL NODETAIL,TRAILER1=(1/,5:'COUNT=',COUNT)
/*
//*
//*
//*-- EXTRACT NUMBER OF RECORDS USING SKIP AND COUNT
//STEP020 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSOUD DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//FILEA DD DSN=INPUT.FILE.HERE,DISP=SHR
//FILEB DD DSN=OUTPUT.FILE.HERE,
// DISP=(NEW,CATLG,DELETE),
// SPACE=(TRK,(120,60),RLSE),
// UNIT=SYSDA,
// DCB=(LRECL=???,RECFM=FB,BLKSIZE=0)
//*
//SYSIN DD *
REPRO -
INFILE(FILEA) -
SKIP(?????) COUNT(15000) -
OUTFILE(FILEB)
/*
// |
|
Thanks ! a lot - Let me give a try and will update you! |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Gary,
You could have dynamically created the SYSIN card for REPRO |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
The usual process is to use SORT and add a sequence number field, sorting on that field in descending order. Then, another SORT to include only the first 15000 records, sorting on the sequence number field in ascending order and removing the sequence numbers from the final output. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Have a look at ICETOOL's SUBSET operator and use LAST(15000). |
|
Back to top |
|
|
Gary McDowell
Active User
Joined: 15 Oct 2012 Posts: 139 Location: USA
|
|
|
|
Pandora-Box wrote: |
Gary,
You could have dynamically created the SYSIN card for REPRO |
Thanks. |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Gary,
Also have a look at Bills solution |
|
Back to top |
|
|
Gary McDowell
Active User
Joined: 15 Oct 2012 Posts: 139 Location: USA
|
|
|
|
Pandora-Box wrote: |
Gary,
Also have a look at Bills solution |
Yep, I saw the ICETOOL solution. We have SYNCSORT as the original posted has posted also. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
SyncSort have SyncTool, commonly aliased to ICETOOL. If you have SyncTool 1.7.0 or later (versions not in step with SyncSort) which is from something like 2008, then SyncTool has SUBSET. Maybe. I can't check :-)
It seems from elsewhere, that TS had a big logfile on a Citrix system, and didn't know how to get at the last 15,000 records, so thought to FTP it to the mainframe and look for a solution there.
However, simple use of "tail" we think has got him there, without the need to FTP. |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
If subset doesnt support TS could go for Expat's solution
It is his call now ;-)
Yes Tail works like gem long time since I used it in unix |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
I remember FILEAID has an option to read the file in reverse and extract 'n' records out of it. If the TS has it in his shop,he could give it a shot. |
|
Back to top |
|
|
mistah kurtz
Active User
Joined: 28 Jan 2012 Posts: 316 Location: Room: TREE(3). Hilbert's Hotel
|
|
|
|
Hi Arun..Yes that's right..the option to select backward read is available in File-Aid.
Code: |
File-AID -------------- Selection Criteria Options -------------------------
COMMAND ===>
Specify Selection Criteria Options:
Start at the following record key
(both blank for start of dataset)
Starting record key ===>
- OR - OR at the following RBA or RRN
Starting RBA or RRN ===>
Initial records to skip ===> 0 then skip this many records
Subsequent Selection Interval: then repeat the following
Records to select ===> 1 - select this many records
Records to skip ===> 0 - then skip this many records
until
Number of records to search ===> 3 you have read this many records
Number of records to select ===> ALL or selected this many records
SEQ/VSAM processing direction ===> B (F = Forward; B = Backward) |
|
|
Back to top |
|
|
Dale Robertson
New User
Joined: 21 Jun 2013 Posts: 44 Location: U.S.A.
|
|
|
|
first count the records in batch or on TSO 3.4 with COUNT line command:
//JS1 EXEC PGM=IKJEFT01
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD *
COUNT 'SEQ.FILE'
/*
//
Then after a little arithmetic use SKIPREC thusly. Be certain to use EQUALS to keep in the order desired!!
//JS2D EXEC PGM=IEFBR14
//DD1 DD DSN=SEQ.FILEOUT,DISP=(MOD,DELETE),SPACE=(TRK,0)
//*
//JS2 EXEC PGM=SYNCSORT
//SORTIN DD DSN=SEQ.FILE,DISP=SHR
//SORTOUT DD DSN=SEQ.FILEOUT,DISP=(,CATLG,DELETE),
// SPACE=(TRK,(10,10),RLSE) or whatever space you need.
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY,EQUALS,SKIPREC=(total minus 15000 records)
/*
// |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
Except that 'COUNT' must be a utility local to your shop because it is not on my system. Please check with TSO Help before posting. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Even if there is a COUNT, why bother? SyncTool has a COUNT operator. The COUNT output can (probably) be directed to a dataset. Generate the SKIPREC with SORT using the COUNT file as input.
And that's only necessary if your SyncTool version is too old to have SUBSET, where it would all be done, in one pass of the file. |
|
Back to top |
|
|
|