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 

Change the Record sequence when condition met

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


Joined: 05 Apr 2006
Posts: 56
Topics: 20

PostPosted: Wed Jan 10, 2007 6:39 pm    Post subject: Change the Record sequence when condition met Reply with quote

The receiving file has variable length. In case if the first record has value
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


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

PostPosted: Wed Jan 10, 2007 7:25 pm    Post subject: Reply with quote

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

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (VB)
//SORTOUT DD DSN=...  output file (VB)
//SYSIN    DD    *
  INREC IFTHEN=(WHEN=INIT,
    BUILD=(1,4,5:SEQNUM,1,ZD,START=0,INCR=5,
      6:SEQNUM,8,ZD,START=0,INCR=10,14:5)),
   IFTHEN=(WHEN=(5,1,ZD,EQ,+0,AND,88,2,CH,EQ,C'YY'),
    OVERLAY=(6:6,8,ZD,ADD,+11,TO=ZD,LENGTH=8))
  SORT FIELDS=(6,8,ZD,A)
  OUTREC BUILD=(1,4,5:14)
/*

_________________
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
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Wed Jan 10, 2007 7:26 pm    Post subject: Reply with quote

Frank will probably drop by and provide an answer.

what you want to do is:
sort each subset (2 records) without changing the basic sequence of the complete file?

will there always be a even number of records?

my instinct is to say 'no to a solution with a utility'; REXX/ezytrieve would be very quick and easy to write. COBOL,PL/I or asm would be a longer solution only because of development time.
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
ldushkin
Beginner


Joined: 05 Apr 2006
Posts: 56
Topics: 20

PostPosted: Wed Jan 10, 2007 7:35 pm    Post subject: Reply with quote

Frank, thannk you so very much.
Unfortunately I cam't test it at this moment, however tomorrow at the same time I will let you know the outcome of my test.
Once again, your help is greatly appreciated.
Back to top
View user's profile Send private message
ldushkin
Beginner


Joined: 05 Apr 2006
Posts: 56
Topics: 20

PostPosted: Wed Jan 10, 2007 7:43 pm    Post subject: Reply with quote

Thank you Dick,

Frank already suggested the ICEMAN, and I have a solution with a Cobol program, however wanted to do it quicker, with lesser steps. I will test Franks JCL tomorrow and will let you know.

To answer your questions: Yes, records are always even.
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


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

PostPosted: Wed Jan 10, 2007 7:46 pm    Post subject: Reply with quote

Note that the DFSORT solution I gave works regardless of whether the number of records is even or odd.
_________________
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
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Wed Jan 10, 2007 8:30 pm    Post subject: Reply with quote

Frank,

The DFSORT Team is producing one very nice, amazing, product.
As a user, I thank the team for the effort.
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


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

PostPosted: Thu Jan 11, 2007 12:18 pm    Post subject: Reply with quote

Dick,

Thanks for the kind words. 8)
_________________
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
ldushkin
Beginner


Joined: 05 Apr 2006
Posts: 56
Topics: 20

PostPosted: Thu Jan 11, 2007 7:28 pm    Post subject: Reply with quote

Frank,
I tried the JCL, the job completed with RC=0, however the output file was the same as input. The swithch didn't appear. Maybe some parameters should be changed, according to my specific file. I only changed the positioning of the characters "YY".
Thank you once again for your help.
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


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

PostPosted: Thu Jan 11, 2007 8:26 pm    Post subject: Reply with quote

I tried to use the information you gave me on your specific file. My solution depends on the 'YY' indicator being in positions 79-80 including the RDW since that's what I assume you had from reading your post. If you have the indicator somewhere else, then the job would need to be adjusted accordingly. Don't forget to include the 4-byte RDW when determining the starting position.

To see if the indicator is actually in 79-80 or 83-84, you can run this DFSORT job:

Code:

//SHOWV1 EXEC  PGM=ICEMAN                   
//SYSOUT    DD  SYSOUT=*                     
//SORTIN  DD DSN=...  input file (VB)       
//SORTOUT DD SYSOUT=*                       
//SYSIN    DD    *                           
  OPTION COPY                                 
  OUTREC FIELDS=(1,4,C'| 79=',79,2,C' | 83=',83,2)         


You can use this job to see if the indicator is somewhere else you think it is.

Once you have the correct starting position (p), I believe the only thing that needs to be adjusted is 88,2,CH,EQ,C'YY' (88 = 79 + 9) - you need p + 9 there. I can help you more with this tomorrow if you need me to.
_________________
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
ldushkin
Beginner


Joined: 05 Apr 2006
Posts: 56
Topics: 20

PostPosted: Thu Jan 11, 2007 9:01 pm    Post subject: Reply with quote

Thank you Frank, I will try it again tomorrow, and will let you know the result.
Smile
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