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 

Find Consecutive records

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF
View previous topic :: View next topic  
Author Message
sivafdms
Intermediate


Joined: 29 May 2007
Posts: 165
Topics: 77

PostPosted: Mon Mar 09, 2009 9:26 pm    Post subject: Find Consecutive records Reply with quote

Hi

I have an input file with FB as recfm & lrecl = 80 in which i need to find the consecutive records and display second one.

Code:

RAM        EZ1234
AIZAZ      MQ3456
SIVA       SZ2390
SIVA       EZ1234
SREE       BN5678


can anyone give me a rexx code

Thanks,
Siva
Back to top
View user's profile Send private message
expat
Intermediate


Joined: 01 Mar 2007
Posts: 475
Topics: 9
Location: Welsh Wales

PostPosted: Tue Mar 10, 2009 6:59 am    Post subject: Reply with quote

But all of the records will be consectutive. Please clarify your requirement.
_________________
If it's true that we are here to help others,
then what exactly are the others here for ?
Back to top
View user's profile Send private message
sivafdms
Intermediate


Joined: 29 May 2007
Posts: 165
Topics: 77

PostPosted: Tue Mar 10, 2009 1:45 pm    Post subject: Reply with quote

expat,

Yes i need to display only consecutive records like below from the file

Code:


SIVA       SZ2390
SIVA       EZ1234




Thanks,
Siva
Back to top
View user's profile Send private message
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Tue Mar 10, 2009 4:05 pm    Post subject: Reply with quote

Code:
save the current record
read next
if key matches saved record
    then display saved and current
    else replace saved record with new record

Of course that only covers 2 consecutive records but you can modify to suit. In fact if your are only displaying the records (SAY record) then you just display all the following records until the key no longer matches.
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
sivafdms
Intermediate


Joined: 29 May 2007
Posts: 165
Topics: 77

PostPosted: Wed Mar 11, 2009 1:04 pm    Post subject: Reply with quote

Nic Clouston,

Thanks for suggestion .. Actually i am new Rexx so if you could provide me code that would be great ful

Thanks,
Siva
Back to top
View user's profile Send private message
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Thu Mar 12, 2009 1:13 pm    Post subject: Reply with quote

Well, I shouldn't do it but....
There are provisos:
1 - I do not have mainframe access so this is untested
2 - I did it off the top of my head so I may have missed something
3 - It is not my fault if it screws things up!

[code:1:69ab03d8dd]
/*- Rexx -----------------------------------------------------------*/
/* */
/* Name : DUPS Date: March 2009 */
/* */
/* Function: Display consecutive duplicate records */
/* */
/* Author : Nic Clouston Smoogro Software */
/* */
/* Copyright Smoogro Software 2009 */
/* */
/* Input : Allocated to DDNAME SYSUT1 in JCL run deck - no need */
/* to allocate file in program. */
/* */
/* Output : SYSPRINT */
/* */
/*----------------------------------------------------------- Rexx -*/
Trace 'N'
saved_key = ''
keystart = 1 /* <=== Provide real values here */
keylength = 8 /* <=== and here */
/* Do an EXECIO here to read n records */
/* e.g. */
'EXECIO 100 DIRSKR SYSUT1 (STEM recsin.'
/* recsin.0 should contain number of records read */
Do While rc = 0 /* EXECIO gives rc=200 (I think) at EOF */

Call process_batch
/* Do an EXECIO here to read n records */
'EXECIO 100 DIRSKR SYSUT1 (STEM recsin.'

End

Call process_batch /* process batch that gave rc
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF 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