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 

How to delete the consequtive record -THRU SYNCSORT

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


Joined: 05 Sep 2003
Posts: 119
Topics: 33
Location: Hyderabad

PostPosted: Tue Jun 13, 2006 7:45 am    Post subject: How to delete the consequtive record -THRU SYNCSORT Reply with quote

Hi,
I am having a VB file with length of 3000.The i/p in the file is like below.
[code:1:2cca1a9af1]
Y.021RRAL1349740 1.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Tue Jun 13, 2006 10:22 am    Post subject: Reply with quote

Bprasanna,

Follow the solution posted by me in this topic.

http://www.mvsforums.com/helpboards/viewtopic.php?t=4356&highlight=sum

Just remove the OMIT cond in step0200 since you want to preserve the first record.

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
bprasanna
Beginner


Joined: 05 Sep 2003
Posts: 119
Topics: 33
Location: Hyderabad

PostPosted: Tue Jun 13, 2006 2:05 pm    Post subject: Reply with quote

Hi Kolusu,
Thanks for the reply.But I got a small doubt here.When I tried to put the stuff in paper(since I am at home and not able to access the mainframe to test the code),Igot this doubt.

Let's see the below example.

I/P file

AAA123
AAA234
AAA546
9AA678
9AA891
AAA123
AAA34Q
9AAR21

Once I use the first control card(inrec),I am goint to get the o/p as

AAA123 0 1
AAA234 0 2
AAA546 0 3
9AA678 1 4
9AA891 1 5
AAA123 0 6
AAA34Q 0 7
9AAR21 0 8

After the outrec the above will turn into

AAA123 1
AAA234 2
AAA546 3
9AA678 5
9AA891 6
AAA123 6
AAA34Q 7
9AAR21 8

In the next step,Since I am using the sum fields=none option on the values,I am going to end up getting the
9AA891 record and the AAA123 record will be dropped.

Am I missing some thing while checking this on paper ?

Once again thanks a lot!

Bprasanna
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Tue Jun 13, 2006 3:17 pm    Post subject: Reply with quote

bprasanna,

I just realized that the above proposed solution will NOT work in your case as both records will be changed.

The following JOb will give you the desired results, but I am not sure your version of syncsort supports the BUILD feature.I assumed that your key ('9' in this case starts at pos 5)

Code:

//STEP0100 EXEC PGM=SORT                             
//SYSOUT   DD  SYSOUT=*                               
//SORTIN   DD  DSN=your input vb file,                 
//             DISP=SHR                               
//SORTOUT  DD  SYSOUT=*                               
//SYSIN    DD  *                                     
  SORT FIELDS=COPY                                     
  OUTREC BUILD=(1,4,5:SEQNUM,8,ZD,RESTART=(5,1),5)     
  OUTFIL OMIT=(5,8,ZD,GT,1,AND,13,1,CH,EQ,C'9'),       
  OUTREC=(1,4,13)                                     
/*


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
bprasanna
Beginner


Joined: 05 Sep 2003
Posts: 119
Topics: 33
Location: Hyderabad

PostPosted: Wed Jun 14, 2006 1:19 am    Post subject: Reply with quote

Hi Kolusu,
I am having the release of Z/OS 1.2.0.0R version.So the Build function won't work in my machine.Do you have any other idea to achive this one?

Thank you
Murali
_________________
----------------
Thanks&Regards
Bprasanna
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Wed Jun 14, 2006 7:34 am    Post subject: Reply with quote

bprasanna,


Found an easier way to delete the second record. try the following control cards. We add a seqnum of 1 byte after the rdw to all the records start with 5 and incrmenting with 5. By doing so every second record will have a zero as seqnum . ex:
Code:

5 Y.021RRAL1349740 1
0 Y.021RLAL140695 01
5 Y.021RLAL144120 01
0 Y.021RLAL145085 01
5 Y.021RLAL133121 01
0 Y.021RLAL134206 01
5 Y.021RLAL141368 01
0 Y.021RLPL142186 01
5 Y.021RTL0000008101
0 Y.021RLAL141368 01
5 Y.025RLAL145308 01
0 Y.025LAL140976 01.
5 9.................
0 9.................
5 Y.1021LCL000084N 1
0 Y.1021LCL000098 N1
5 X.1021LCL000099 N1
0 X.1021LCL000091 N1
5 X.1021LCL000108 N1
0 X.1025LCL000088 N1
5 X.1025LCL000093 N1
0 X.1025LCL000112 N1
5 X.1025LCL000114 N1
0 9...... ..... ....


Now using an OMIT cond on OUTFIL we remove the unwanted record and also get rid of the temp seqnum we added.
Code:

//SYSIN    DD  *                                   
 SORT FIELDS=COPY                                 
 INREC FIELDS=(1,4,                               
               SEQNUM,1,ZD,START=5,INCR=5,         
               5)                                 
 OUTFIL OMIT=(5,1,ZD,EQ,0,AND,6,1,CH,EQ,C'9'),     
 OUTREC=(1,4,6)                       
/*


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
bprasanna
Beginner


Joined: 05 Sep 2003
Posts: 119
Topics: 33
Location: Hyderabad

PostPosted: Wed Jun 14, 2006 1:28 pm    Post subject: Reply with quote

kolusu,
I think this one also won't work as we are expecting.This will work only if the
records are in odd number and will fail in case of even numbers.
See the below example.
i/p file

AAA
A99
A66
A88
9AA
9BB
AZA
AZC
9ZZ

After adding the incrimental value of 5 ,we are going to have the
0AAA
5A99
0A66
5A88
09AA
59BB
0AZA
5AZC
09ZZ

Now if I am going to use the omit(0 and 9) condition,then the o/p will be
AAA
A99
A66
A88
9BB
AZA
AZC

Where I am expecting the o/p as

AAA
A99
A66
A88
9AA
AZA
AZC
9ZZ

Thank you

Bprasanna
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Wed Jun 14, 2006 2:56 pm    Post subject: Reply with quote

bprasanna,

I cannot think of a solution with the available features of syncsort. If easytrieve is an option then following the code will give you the desired results.

Code:

//STEP0100 EXEC PGM=EZTPA00
//STEPLIB  DD DSN=EASYTREV.LOADLIB,
//            DISP=SHR                       
//SYSPRINT DD SYSOUT=*                       
//SYSOUT   DD SYSOUT=*                       
//INFILE   DD DSN=your input vb file,     
//            DISP=SHR                   
//OUTFILE  DD SYSOUT=*,DCB=*.INFILE     
//SYSIN   DD *                           
                                         
FILE INFILE VB(3000 0)                   
     IN-KEY           01  01 A           
                                         
FILE OUTFILE VB(3000 0)                 
                                         
SKIP-CNT  W 02 B 0                       
                                         
JOB INPUT INFILE                         
                                         
  IF IN-KEY = '9'                       
     SKIP-CNT  = SKIP-CNT + 1           
  ELSE                                   
     SKIP-CNT  = 0                       
  END-IF                                 
                                         
  IF SKIP-CNT LE 1                       
     PUT OUTFILE FROM INFILE             
  END-IF                   
/*


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
bprasanna
Beginner


Joined: 05 Sep 2003
Posts: 119
Topics: 33
Location: Hyderabad

PostPosted: Mon Jun 19, 2006 5:21 am    Post subject: Reply with quote

Kolusu,
Thanks for the info.

Thank you
Bprasanna
_________________
----------------
Thanks&Regards
Bprasanna
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 -> 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