Change the Record sequence when condition met
Select messages from
# through # FAQ
[/[Print]\]

MVSFORUMS.com -> Utilities

#1: Change the Record sequence when condition met Author: ldushkin PostPosted: Wed Jan 10, 2007 6:39 pm
    —
The receiving file has variable length. In case if the first record has value

#2:  Author: Frank YaegerLocation: San Jose PostPosted: Wed Jan 10, 2007 7:25 pm
    —
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)
/*

#3:  Author: dbzTHEdinosauerLocation: germany PostPosted: Wed Jan 10, 2007 7:26 pm
    —
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.

#4:  Author: ldushkin PostPosted: Wed Jan 10, 2007 7:35 pm
    —
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.

#5:  Author: ldushkin PostPosted: Wed Jan 10, 2007 7:43 pm
    —
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.

#6:  Author: Frank YaegerLocation: San Jose PostPosted: Wed Jan 10, 2007 7:46 pm
    —
Note that the DFSORT solution I gave works regardless of whether the number of records is even or odd.

#7:  Author: dbzTHEdinosauerLocation: germany PostPosted: Wed Jan 10, 2007 8:30 pm
    —
Frank,

The DFSORT Team is producing one very nice, amazing, product.
As a user, I thank the team for the effort.

#8:  Author: Frank YaegerLocation: San Jose PostPosted: Thu Jan 11, 2007 12:18 pm
    —
Dick,

Thanks for the kind words. 8)

#9:  Author: ldushkin PostPosted: Thu Jan 11, 2007 7:28 pm
    —
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.

#10:  Author: Frank YaegerLocation: San Jose PostPosted: Thu Jan 11, 2007 8:26 pm
    —
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.

#11:  Author: ldushkin PostPosted: Thu Jan 11, 2007 9:01 pm
    —
Thank you Frank, I will try it again tomorrow, and will let you know the result.
Smile



MVSFORUMS.com -> Utilities


output generated using printer-friendly topic mod. All times are GMT - 5 Hours

Page 1 of 1

Powered by phpBB © 2001, 2005 phpBB Group