View previous topic :: View next topic |
Author |
Message |
sivafdms Intermediate
Joined: 29 May 2007 Posts: 165 Topics: 77
|
Posted: Mon Mar 09, 2009 9:26 pm Post subject: Find Consecutive records |
|
|
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 |
|
 |
expat Intermediate

Joined: 01 Mar 2007 Posts: 475 Topics: 9 Location: Welsh Wales
|
Posted: Tue Mar 10, 2009 6:59 am Post subject: |
|
|
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 |
|
 |
sivafdms Intermediate
Joined: 29 May 2007 Posts: 165 Topics: 77
|
Posted: Tue Mar 10, 2009 1:45 pm Post subject: |
|
|
expat,
Yes i need to display only consecutive records like below from the file
Code: |
SIVA SZ2390
SIVA EZ1234
|
Thanks,
Siva |
|
Back to top |
|
 |
Nic Clouston Advanced
Joined: 01 Feb 2007 Posts: 1075 Topics: 7 Location: At Home
|
Posted: Tue Mar 10, 2009 4:05 pm Post subject: |
|
|
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 |
|
 |
sivafdms Intermediate
Joined: 29 May 2007 Posts: 165 Topics: 77
|
Posted: Wed Mar 11, 2009 1:04 pm Post subject: |
|
|
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 |
|
 |
Nic Clouston Advanced
Joined: 01 Feb 2007 Posts: 1075 Topics: 7 Location: At Home
|
Posted: Thu Mar 12, 2009 1:13 pm Post subject: |
|
|
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 |
|
 |
|
|