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 

Extract all rows till EOF from the row with a value given

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
Jeba
Beginner


Joined: 02 Dec 2002
Posts: 48
Topics: 9
Location: Columbus, GA

PostPosted: Tue Sep 21, 2004 3:26 pm    Post subject: Extract all rows till EOF from the row with a value given Reply with quote

Hi,

I have an input file with the following data

Code:

Sep 19 2004
x rows of records
Sep 20 2004
y rows of records
Sep 21 2004
z rows of records


I need to extract only the following records
Code:

Sep 21 2004
z rows of records


Is it possible to retrieve the output like this using SORT or some other tools

Your help will be apprciated
_________________
Thanks,
Jeba
(Known is a drop Unknown is an ocean)
Back to top
View user's profile Send private message Send e-mail
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Tue Sep 21, 2004 4:13 pm    Post subject: Reply with quote

What are the exact "rules" for which records to extract? From your brief example, one could guess the last 2 records, or the 5th and 6th records, or the records with "21" and "z" or ...? You have to give us more to go on.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Jeba
Beginner


Joined: 02 Dec 2002
Posts: 48
Topics: 9
Location: Columbus, GA

PostPosted: Tue Sep 21, 2004 5:28 pm    Post subject: Reply with quote

Frank,

Sorry for not providing enough information.

Daily, this particular file will be updated by other application and the log records will be written after the today's date.

x,y,z -> can have any value

I need to extract the records starting from the todays date (Sep 21 2004)given ( today's date can be given as the input in the control card). i.e., I need only today's log records in the output

If date is available in all the records, then it will be easy to extract the records. But date will be available only at the initial record.

Let me know if you need more information
_________________
Thanks,
Jeba
(Known is a drop Unknown is an ocean)
Back to top
View user's profile Send private message Send e-mail
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Tue Sep 21, 2004 6:53 pm    Post subject: Reply with quote

Jeba,

Here's a DFSORT/ICETOOL job that will do what you asked for:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
RECORD
/*
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN    DD    *
  OPTION COPY
* Get date as yyyymmdd
 INREC FIELDS=(DATE1)
* Get Symbol for date as:
* Curdate,'mon dd yyyy'
  OUTREC FIELDS=(C'Curdate,''',
   5,2,CHANGE=(3,
    C'01',C'Jan',C'02',C'Feb',C'03',C'Mar',C'04',C'Apr',
    C'05',C'May',C'06',C'Jun',C'07',C'Jul',C'08',C'Aug',
    C'09',C'Sep',C'10',C'Oct',C'11',C'Nov',C'12',C'Dec'),X,
   7,2,X,1,4,C'''',80:X)
/*
//S2    EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//IN DD DSN=...  input file
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//CTL3CNTL DD DSN=&&T1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//OUT DD SYSOUT=*
//TOOLIN DD *
* IN->T1: Add SEQNUM to IN records.
   COPY FROM(IN) TO(T1) USING(CTL1)
* T1->CTL3CNTL:  Generate:
*   OPTION COPY,SKIPREC=n
* where n is seqnum-1 of Curdate record.
   COPY FROM(T1) TO(CTL3CNTL) USING(CTL2)
* IN->OUT:  Use OPTION COPY,SKIPREC=n
* to get record with current date and
* subsequent records.
   COPY FROM(IN) TO(OUT) USING(CTL3)
/*
//CTL1CNTL DD *
   INREC FIELDS=(1,80,81:SEQNUM,8,ZD)
/*
//CTL2CNTL DD *
   INCLUDE COND=(1,11,CH,EQ,Curdate)
   OPTION STOPAFT=1
   OUTREC FIELDS=(C' OPTION COPY,SKIPREC=',
     81,8,ZD,SUB,+1,TO=ZD,LENGTH=8,80:X)
/*

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort


Last edited by Frank Yaeger on Wed Sep 22, 2004 9:25 am; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
kolusu
Site Admin
Site Admin


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

PostPosted: Wed Sep 22, 2004 8:43 am    Post subject: Reply with quote

Frank,

I guess you forgot to change the //SORTIN DD input file. &&IN was the input data set used for your test. If the date occurs only once in the file then do we really need 3 passes of data? I can think we can club CTL1 & CTL2 control cards into 1 single control card.
Code:

//CTL1CNTL DD *
   INREC FIELDS=(1,80,81:SEQNUM,8,ZD,START=0,INCR=1)
   OUTFIL FNAMES=CTL2CNTL,INCLUDE=(1,11,CH,EQ,Curdate),
   OUTREC=(C' OPTION COPY,SKIPREC=',81,8,80:X)
/*


Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Wed Sep 22, 2004 9:30 am    Post subject: Reply with quote

Kolusu,

Yes, I forgot to change the //SORTIN DD. I've fixed it.

Yes, if there's only one date that matches the current date, then we could do it in one less pass. And using START=0 to get seqnum-1 for SKIPREC is a good idea.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Jeba
Beginner


Joined: 02 Dec 2002
Posts: 48
Topics: 9
Location: Columbus, GA

PostPosted: Wed Sep 22, 2004 2:38 pm    Post subject: Reply with quote

Frank/ Kolusu,

Great!!!!

Thanks for the solution. It is working good. I have used CTL1CNTL from Kolusu's reply and removed the CTL3CNTL since the input record will have only one date that matches the current date.
_________________
Thanks,
Jeba
(Known is a drop Unknown is an ocean)
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
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